首页 > 其他 > 详细

1.3 std:: 介绍

时间:2015-05-14 13:57:05      阅读:198      评论:0      收藏:0      [点我收藏+]

std:: 是命名空间标识符,C++标准库中的函数或者对象都是在命名空间std中定义的

cout是标准库所提供的一个对象,因此在使用cout时要用std::cout

如果不喜欢重复使用std,可以使用:

using std::cout;

using std::endl;

#include<iostream>
using std::cout;
using std::endl;
int main(){
    cout << "Hello World!";
    return 0;
}

也可以使用:

using namespace std;

#include<iostream>
using namespace std;
int main(){
    cout << "Hello World!";
    return 0;
}

 

1.3 std:: 介绍

原文:http://www.cnblogs.com/cplusplus-study/p/4503035.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!