摘要:
使用命名空间,可以避免重名问题例如:#includenamespace a{ int x = 8;}namespace b{ int x = 9;}int main(){ int x = 10; std::cout << a::x << b::x << x << std::e... 阅读全文
posted @ 2015-05-14 12:59
cppstudy
阅读(126)
评论(0)
推荐(0)
摘要:
如果用iostream则需要加命名空间;如果用iostream.h则不需要加命名空间;示例:#includeusing namespace std;int main(){ cout int main(){ cout << "Hello World!"; return 0;} 阅读全文
posted @ 2015-05-14 12:55
cppstudy
阅读(122)
评论(0)
推荐(0)
摘要:
std:: 是命名空间标识符,C++标准库中的函数或者对象都是在命名空间std中定义的cout是标准库所提供的一个对象,因此在使用cout时要用std::cout如果不喜欢重复使用std,可以使用:using std::cout;using std::endl;#includeusing std::... 阅读全文
posted @ 2015-05-14 12:53
cppstudy
阅读(352)
评论(0)
推荐(0)
摘要:
C++中使用 cout 来输出,cout是一个对象,存在与 iostream 中,因此要先引入该文件例子:std::coutint main(){ std::cout << "Hello World!"; return 0;} 阅读全文
posted @ 2015-05-14 12:43
cppstudy
阅读(140)
评论(0)
推荐(0)
摘要:
#includeint main(){ std::cout << "Hello World!"; return 0;} 阅读全文
posted @ 2015-05-14 12:39
cppstudy
阅读(110)
评论(0)
推荐(0)

浙公网安备 33010602011771号