请人看个C++程序~把头文件换成#include<iostream.h>就可以了~请问什么原因呢?

[复制链接]
查看11 | 回复2 | 2011-4-8 21:16:03 | 显示全部楼层 |阅读模式
#include
#include
#include
using namespace std;
//m*n 阶矩阵
class M
{
public:
M(int m, int n);
M(M& m);
virtual ~M();
int m;
int n;
private:
int *a;
friend istream& operator>>( istream& in, M& m );
friend ostream& operator>( istream& in, M& m )
{
cout (*(m.a+i*m.n+j));
}
}
return in;
}
//输出矩阵
ostream& operator>a>>b;
M c = a + b;
cout<<a<<"--------"<<endl< 这个是VC6以前的写法。 #include using namespace std; 这个是标准库的写法。标准库把这些个文件都放到std这个namespace里面了。 可以到VC\include看看和VC6.0的区别,是iostream而不是iostream.h。 注意是两个不同的东西是STL库是兼容于c的库所有STL库
回复

使用道具 举报

千问 | 2011-4-8 21:16:03 | 显示全部楼层
#include换成#include就能用说明你用的VC++版本比较低,一般是没打过补丁的VC++ 6.0。
回复

使用道具 举报

千问 | 2011-4-8 21:16:03 | 显示全部楼层
vc 6.0编译器的问题友元重载运算符只能加.h 程序没问题的 我以前也遇到过
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行