帮我看看错误

来源:百度知道 编辑:UC知道 时间:2024/06/27 05:46:04
#include<iostream>
using namespace std;
class complex
{
private:
int real;
int imag;
public:
friend complex operator+(complex &a,complex &b);
void set(int r,int i);
void display();

};
complex operator +(complex &a,complex &b)
{ complex temp;
temp.real=a.real+b.real;
temp.imag=a.imag+b.imag;
return temp;
}
void complex::set(int r,int i)
{real=r;
imag=i;}
void complex::display()
{cout<<real<<"+"<<imag<<"i"<<endl;}
int main()
{
complex c1,c2,c3;
c1.set(1,1);
c2.set(2,1);
c3.set(0,0);
c3=c1+c2;
c3.display();
return 0;
}
运行不正确,编译器报的错是
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 o

这个程序在我机子上运行是正确的,你再新一个文件夹,然后再把这个文件放里边,编译运行一下,看看行不?我用的软件是:Turbo C\c++ For Windows 集成实验与学习环境很好用的,http://165.newhua.com/down/turboc_41427.rar界面如下图点击查看http://hiphotos.baidu.com/weirhp/pic/item/c7002d29806a46f399250aa8.jpg
调一下选项:如下图点击查看http://hiphotos.baidu.com/weirhp/pic/item/8b2e4b608637f8d28db10da8.jpg
http://hiphotos.baidu.com/weirhp/pic/item/615185586a9615d39c8204a8.jpg