输入输出要用到这个.

标准C++库的所有的标识符都是在一个名为std的命名空间中定义的,或者说标准头文件(如iostream)中函数、类、对象和类模板是在命名空间 std中定义的。std是standard(标准)的缩写,表示这是存放标准库的有关内容的命名空间。

二元作用域分辨运算符::

using std::cout;

using std::cin;

using std::endl; 

 

1、std::cout<<”OK.”

2、using namespace std;

     cout<<”OK.”

3、using std::cout;

     cout<<”OK.”

 

 

【参考】

C++命名空间 namespace的作用和使用解析 - 莫水千流 - 博客园 https://www.cnblogs.com/zhoug2020/p/5972439.html

C++的命名空间的使用 - 王会喜 - 博客园 https://www.cnblogs.com/wanghuixi/p/6887390.html

相关文章:

  • 2022-01-03
  • 2021-10-16
  • 2021-10-01
  • 2021-09-05
  • 2022-02-15
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2022-02-26
  • 2022-02-23
  • 2022-01-23
  • 2022-12-23
  • 1970-01-01
相关资源
相似解决方案