命名空间是引入c++中的一种技术,为了解决在编程中遇到的命名冲突问题,因为在大型软件开发时会遇到大量变量命名。例如我们通常所用的cout其实全名是std::cout,加上using namespace std时,就告诉编译器使用std中的名字,那么遇到cout时,就是std::cout了
而在iostream。h中定义了cout,包含了这个头文件,就可直接用cout了。
#include
using namespace std;
和
#include
#include
using namespace std;这两句是告诉编译器包含文件iostream,里面的变量限定在std中,而#include