1 #include <iostream>
2
3 //using namespace std; 第一种
4
5 #if 0
6 using std::cout;
7 using std::endl;
8 #endif
9
10 int main()
11 {
12 //cout<<"hello world"<<endl; 第一种
13
14 //std::cout<<"hello world"<<std::endl; 第二种
15
16 cout<<"hello_world"<<endl;
17 return 0;
18 }
C++学习第一篇_打印hello world的3中方式
最新推荐文章于 2024-06-29 02:36:02 发布
本文展示了一个简单的C++程序示例,通过不同的方式使用标准输出流来打印字符串hello_world。文中包括了如何使用using声明特定的std命名空间元素以及直接调用std命名空间的方法。
1万+

被折叠的 条评论
为什么被折叠?



