转换构造函数问题
#include "iostream"using namespace std;
class Complex{
public:
Complex(){real=0;imag=0;}
Complex(double r){real=r;imag=0;}
Complex(double r,double i){real=r;imag=i;}
friend Complex operator +(Complex c1,Complex c2);
void display();
private:
double real;
double imag;
};
Complex operator +(Complex c1,Complex c2)
{
Complex c3;
c3.real=c1.real+c2.real;
c3.imag=c1.imag+c2.imag;
return c3;
}
void Complex::display()
{cout<<"("real<<","<<imag"<<i)"<<endl;}
void main()
{
Complex c1(2.5,3.6),c2(2.0,3.8),c3;
c3=c1+1.5;
c3.display();
}
f:\c程序\转换构造函数\late.cpp(8) : 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
Error executing cl.exe.
late.obj - 1 error(s), 0 warning(s)
我没见过那样的错误,那程序代码还是从书上找的,运行结果怎么会那样?!求解,求解。