问题描述
- 这是什么错误啊??求大神指教,
-
--------------------Configuration: zy1 - Win32 Debug--------------------
Compiling...
1.cpp
D:VC++6.0Microsoft Visual StudioMyProjectszy11.cpp(47) : 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 时出错.1.obj - 1 error(s), 0 warning(s)
解决方案
/*1.已知一个有理数类zrf_Ratio,包含私有数据成员:分子num和分母den, 以及公有函数成员 friend ostream& operator<<(ostream& ostr, const zrf_Ratio& r) { return ostr << r.num << "/" << r.den;} 请补充该类的构造函数,并实现如下的操作符重载形式: friend zrf_Ratio operator-(const zrf_Ratio&); friend zrf_Ratio operator+(const zrf_Ratio&, const zrf_Ratio&); friend zrf_Ratio operator-(const zrf_Ratio&, const zrf_Ratio&); friend zrf_Ratio operator*(const zrf_Ratio&, const zrf_Ratio&); friend zrf_Ratio operator/(const zrf_Ratio&, const zrf_Ratio&);*/
#include
using namespace std;
int f1()
{ int m,n,t;
cout<<"请输入两个数:";
cin>>m>>n;
while(n!=0)
{ t=m%n; m=n; n=t; }
return m;
}
class zrf_Ratio
{
public:
friend ostream& operator<<(ostream& ostr, const zrf_Ratio& r)
{ return ostr << r.num << "/" << r.den;}
friend zrf_Ratio operator-(const zrf_Ratio& r0 )
{return zrf_Ratio(-r0.num,r0.den);}
friend zrf_Ratio operator+(const zrf_Ratio& r1, const zrf_Ratio& r2)
{ int a=f1(r1.den,r2.den); return zrf_Ratio((r1.num*r2.den+r2.num*r1.den)/d,r1.den*r2.den/d); }
friend zrf_Ratio operator-(const zrf_Ratio& r1, const zrf_Ratio& r2)
{ int a=f1(r1.den,r2.den); return zrf_Ratio((r1.num*r2.den-r2.num*r1.den)/d,r1.den*r2.den/d); }
friend zrf_Ratio operator*(const zrf_Ratio& r1, const zrf_Ratio& r2)
{ int a=f1(r1.den,r2.den); while(a!=1) { r1.num*r2.num/=d; r1.den*r2.den/=d; d=f1(r1.num*r2.num,r1.den*r2.den); } return zrf_Ratio(r1.num*r2.num,r1.den*r2.den); }
friend zrf_Ratio operator/(const zrf_Ratio& r1, const zrf_Ratio& r2)
{return r1*zrf_Ratio(r2.num,r2.den);}
private:
int num,den;
};
int mian()
{
zrf_Ratio m(3,7);
zrf_Ratio n(4,9);
p(-a);
p(a+b);
p(a-b);
p(a*b);
p(a/b);
return 0; }
就是这个题目,这代码肯定有好多错误,希望前辈可以耐心指教,谢谢
解决方案二:
只能看出是链接出错,比如外部函数没有定义,函数名重复,函数定义和申明不一致,全局变量不正确,缺少lib等等都可能会有这种错误。
贴出你的代码
解决方案三:
是因为电脑管理权限的问题,用超级管理账户登陆就可以正常使用了。
When you investigate a possible problem with the Microsoft Visual C++ compiler or linker, it is important to obtain as much information as possible about the build process and the options being used. This article discusses some trouble-shooting tips to help you resolve your build problem.