如果用iostream则需要加命名空间;
如果用iostream.h则不需要加命名空间;
示例:
#include<iostream> using namespace std; int main(){ cout << "Hello World!"; return 0; }
#include<iostream.h> int main(){ cout << "Hello World!"; return 0; }
本文探讨了在C++中使用iostream与iostream.h的区别,特别是在命名空间的使用上。通过两个示例代码,展示了如何在使用iostream时声明命名空间,而在使用iostream.h时则无需此步骤。
如果用iostream则需要加命名空间;
如果用iostream.h则不需要加命名空间;
示例:
#include<iostream> using namespace std; int main(){ cout << "Hello World!"; return 0; }
#include<iostream.h> int main(){ cout << "Hello World!"; return 0; }
转载于:https://www.cnblogs.com/cplusplus-study/p/4503040.html

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