c++中一个看不懂的错误
#include <iostream>
using namespace std;
class Complex
{
public:
Complex (double r,double im)
{real=r;imag=im;}
Complex (double r)
{real=r;}
Complex ()
{real=0;imag=0;}
Complex operator +(double &i)
{return Complex (real+i,imag);}
Complex operator +(Complex &x1)
{return Complex (real+x.real,imag+x1.imag);}
friend Complex operator +(double &i,Complex &x1);
void display()
{
cout<<"the sum of complexes are:"<<real<<"+"<<imag<<"i"<<endl;
}
private:
double real;
double imag;
};
Complex operator +(double &i,Complex &x1)
{
return Complex (i+x1.real,x1.imag);
}
int main()
{
Complex x,x1,x2,x3,i;
x2=x+x1;
x3=x+i;
cout<<"x=";x.display();
cout<<"x1=";x1.display();
cout<,"i=";i.display();
cout<<"x+x1=";x2.display();
cout<<"x+i=";display();
return 0;
}
错误提示是:
c:\users\asus\documents\tencent files\396549821\filerecv\22.cpp(16) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
执行 cl.exe 时出错.
请指点错误。
还有,我用的是vc++6.0 我想换一个编译器,请推荐并留下下载地址,3Q