奥克兰城市地图:编程中的问题

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 12:35:40
错误如下:
C:\Program Files\Microsoft Visual Studio\MyProjects\作业\本次作业.cpp(19) : error C2059: syntax error : '{'
complex::complex operator+(const complex &p)
{complex temp;
temp.real=real+p.real;
temp.imaginary=imaginary+p.imaginary;
return temp;
}
complex::complex operator-(const complex &p)
{return complex(real-p.real,imaginary-p.imaginary);
}
istream &operator>>(istream & input,complex&p)
{cout>>"input the real and imaginary part of the complex:"
input>>p.real>>p.imaginary;
return input;
}

缺少了吗?

看一下“本次作业.cpp”的第19行前后的函数,应该少了一个大括弧。

缺少一个大括弧

括号匹配的问题,请查看一下所有的括号是否都一一对应