fatal error C1001: INTERNAL COMPILER ERROR是什么意思以下是程序代码#includeusing namespace std;class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} friend Complex operator+(Complex &c1,Complex &c2);

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 02:40:03
fatalerrorC1001:INTERNALCOMPILERERROR是什么意思以下是程序代码#includeusingnamespacestd;classComplex{public:Compl

fatal error C1001: INTERNAL COMPILER ERROR是什么意思以下是程序代码#includeusing namespace std;class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} friend Complex operator+(Complex &c1,Complex &c2);
fatal error C1001: INTERNAL COMPILER ERROR是什么意思
以下是程序代码
#include
using namespace std;
class Complex
{
public:
Complex(){real=0;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 &c2)
{
Complex c;
c.real=c1.real+c2.real;
c.imag=c1.imag+c2.imag;
return c;
}
void Complex::display()
{
cout

fatal error C1001: INTERNAL COMPILER ERROR是什么意思以下是程序代码#includeusing namespace std;class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} friend Complex operator+(Complex &c1,Complex &c2);
这个是VC6.0的一个BUG.
不要用using namespace std;
改成
using std::cout;
using std::endl;就可以了
总体上代码改成以下方式就可以编译通过了.
这个是VC的BUG,与你的程序本身没有关系.
#include
using std::cout;
using std::endl;
class Complex
{
public:
Complex(){real=0;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 c;
c.real=c1.real+c2.real;
c.imag=c1.imag+c2.imag;
return c;
}
void Complex::display()
{
cout