C++ cout 标准输出流
cout
C++中,cout是标准库iostream中的内置类实例,是std命名空间中的一个标准输出流对象,通常与流插入运算符“<<”结合使用,其主要作用在于将数据标准地输出在当前的设备上(一般为显示屏),输出的类型可包括(不仅限):整型、浮点型、字符串和指针等。使用之前,一般需要先通过using namespace std使用std的命名空间,否则需要在cout的前面加上"std::",比如:“std::cout”。
cout语法
std::cout << value;
cout实例代码
#include <iostream>
using namespace std;
int main(){
string x = "笨鸟工具,x1y1z1.com";
cout << x << endl;
return 0;
}
免责声明:内容仅供参考,不保证正确性!