นิยาม
std::cout เป็น object ของ class ostream แทน standard output stream narrow characters (char) Corresponds to C stdout
คุณสมบัติ
- Default destination: console (shared กับ cerr/clog ได้)
- เขียนข้อมูล 2 แบบ: formatted (
<<) และ unformatted (write) - ประกาศใน
<iostream>external linkage, static duration
ตัวอย่าง
#include <iostream>
int main() {
std::cout << "Hello";
return 0;
}
Compile & Run
$ g++ hello.cpp $ ./a.out
ผลลัพธ์
Hello
หมายเหตุ: เนื้อหานี้ทับซ้อนกับ ID 1004083497 และ 1004083505