码迷,mamicode.com
首页 > 编程语言 > 详细

std申明的三种方法_C++课程学习

时间:2017-08-04 15:16:48      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:命名   ++   color   nbsp   int   课程   std   课程学习   turn   

 1 int main()
 2 {
 3     #if 0   //第1种:直接使用
 4         std::cout<<"hello world"<<std::endl;
 5     #endif
 6 
 7     #if 0   //第2种:先申明使用指定的内容
 8         using   std::cout;
 9         using   std::endl;
10         cout<<"hello world"<<endl;
11     #endif
12 
13     #if 1   //第3种:申明使用标准命名空间中所有内容
14         using   namespace   std;    //一般申明在头文件后
15         cout<<"hello world"<<endl;
16     #endif
17 
18     return  0;
19 }

 

intmain()
{
#if0//第1种:直接使用
std::cout<<"hello world"<<std::endl;
#endif

#if0//第2种:先申明使用指定的内容
usingstd::cout;
usingstd::endl;
cout<<"hello world"<<endl;
#endif

#if1//第3种:申明使用标准命名空间中所有内容
usingnamespacestd;//一般申明在头文件后
cout<<"hello world"<<endl;
#endif

return0;
}

std申明的三种方法_C++课程学习

标签:命名   ++   color   nbsp   int   课程   std   课程学习   turn   

原文地址:http://www.cnblogs.com/linuxAndMcu/p/7285070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!