菜鸟问题,求好心人解答。

m晴天vs小猪m m晴天vs小猪m 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#ifndef POINT_H
#define POINT_H

#include<iostream>
class Point{
public :
Point(int ,int );
Point(Point &);
~Point();
int get_x();
int get_y();
void put_x(int x);
void put_y(int y);
Point operator+(Point p);
Point operator*(int i);
Point operator>(Point p);
Point operator<(Point p);
int operator==(Point &p);
private :
int x;
int y;
friend istream& operator >> (istream & in , Point &p);
friend ostream& operator << (istream & out , Point &p);

}
#endif

类定义如上
使用vs2010进行编译
编译失败
log如下:


错误 1 error C2143: 语法错误 : 缺少“;”(在“&”的前面) x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 2 error C2433: “istream”: 不允许在数据声明中使用“friend” x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 3 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 4 error C2061: 语法错误: 标识符“istream” x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 5 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 6 error C2805: 二进制“operator >>”的参数太少 x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
错误 7 error C2143: 语法错误 : 缺少“;”(在“&”的前面) x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 8 error C2433: “ostream”: 不允许在数据声明中使用“friend” x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 9 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 10 error C2061: 语法错误: 标识符“istream” x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 11 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 12 error C2805: 二进制“operator <<”的参数太少 x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
错误 13 error C1004: 发现意外的文件尾 x:\code\vs\data struct\类定义\类定义\类定义.cpp 27
14 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
15 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 22
16 IntelliSense: 未定义标识符 "ostream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
17 IntelliSense: 未定义标识符 "istream" x:\code\vs\data struct\类定义\类定义\类定义.cpp 23
...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
m晴天vs小猪m
C++ 语言 65,214 成员 250,514 内容