#include <iostream.h>非标准输入输出流
#include <iostream>标准输入输出流
C++中为了避免名字定义冲突,特别引入了“名字空间的定义”,即namespace。
当代码中用<iostream.h>时,输出可直接引用cout<<x;//<iostream.h>继承C语言的标准库文件,未引入名字空间定义,所以可直接使用。
当代码中引入<iostream>时,输出需要引用std::cout<<x;如果还是按原来的方法就会有错。
使用<iostream>时,引入std::有以下方法:
1.
using namespace std;
cout<<x;
cout<<x<<endl;
2.
using std::cout;
cout<<x;
若使用此方式,则需要分别将需要释放的对象加上using
例如:using std::cout;
using std::endl;
using std::cin;
cout<<x<<endl;
cin>>x;
3.
最基本的std::cout<<x; std::cout<<x<<std::endl;
#include <iostream.h>这样写,里面的函数都是全局函数.