关于头文件的一个小问题,高手进来下…………
为什么下面的代码用#include <iostream> using namespace std;就不不能通过编译,而用#include <iostream.h>却可以???这两个头文件的不是同样的意思吗???他们有什么区别吗???include <iostream.h>
class shijian
{
private:
public:
int year;
int month;
int day;
public:
friend ostream& operator<<(ostream& output,shijian &sj);
friend istream& operator>>(istream& input,shijian &x);
};
ostream& operator<<(ostream &output,shijian &sj)
{
output << sj.year << "/" << sj.month << "/" << sj.day << endl;
return output;
}
istream& operator>>(istream& input,shijian &x)
{
input >> x.year >> x.month >> x.day;
return input;
}
int main()
{
shijian a;
cin>>a;
cout<<a;
return 0;;
}