1
回答
fatal error C1001: INTERNAL COMPILER ERROR 小弟我是初学者 求大神抽时间帮忙看看
终于搞明白,存储TCO原来是这样算的>>>   
#include<iostream>
using namespace std;
class Complex
{
public: 
Complex(double r=0.0,double i=0.0)
{real=r;image=i;} 
friend Complex operator + (Complex c1,Complex c2);
    friend Complex operator - (Complex c1,Complex c2);
void display();
private:
double real; //复数实部
double image; //复数虚部
};
Complex operator + (Complex c1,Complex c2)
{
Complex c;
    c.real=c1.real+c2.real;
c.image=c1.image+c2.image;
return c;
}
Complex Complex:: operator - (Complex c2)
{
return Complex( c1.real-c2.real,c1.image-c2.image);
}
void Complex::display( )
{
if(image>0)
cout<<real<<'+'<<image<<'i';
else
cout<<real<<image<<'i';
}
int main()
{
double real,image;
cin>>real>>image;
    Complex c1(real,image);
cin>>real>>image;
    Complex c2(real,image);
Complex c3;
    c3=c1+c2;
c3.display();
c3=c1-c2;
c3.display();
return 0;
} 
举报
Hi_BaBy
发帖于5年前 1回/882阅
顶部