帮我看看程序为什么通不过???
////example of complex class and convertion of class type
//authro:zhaodong
/*
#include <iostream.h>
#include <math.h>
#define pi 3.1415
class Complex;
class TTT
{
public:
double r;
double q;
public:
TTT(double t1=0,double t2=0 )
{
r = t1;
q = t2;
}
operator Complex()
{
Complex *temp;
temp->Rem = r*cos(q);
temp->Imp = r*sin(q);
return *temp;
}
};
class Complex
{
public:
double Rem;
double Imp;
public:
Complex()
{
Rem = 0;
Imp = 0;
}
Complex(int a)
{
Rem = a;
Imp = 0;
}
Complex(int a, int b)
{
Rem = a;
Imp = b;
}
friend Complex operator+(Complex t1, Complex t2)
{
Complex temp;
temp.Rem = t1.Rem + t2.Rem;
temp.Imp = t1.Imp + t2.Imp;
return temp;
}
friend Complex operator-(Complex t1, Complex t2)
{
Complex temp;
temp.Rem = t1.Rem - t2.Rem;
temp.Imp = t1.Imp - t2.Imp;
return temp;
}
friend Complex operator*(Complex t1, Complex t2)
{
Complex temp;
temp.Rem = t1.Rem*t2.Rem - t1.Imp*t2.Imp;
temp.Imp = t1.Rem*t2.Imp + t1.Imp*t2.Rem;
return temp;
}
friend Complex operator/(Complex t1, Complex t2)
{
Complex temp;
temp.Rem = (t1.Rem*t2.Rem + t1.Imp*t2.Imp)/(t2.Imp*t2.Imp + t2.Rem*t2.Rem);
temp.Imp = (t1.Imp*t2.Rem - t1.Rem*t2.Imp)/(t2.Imp*t2.Imp + t2.Rem*t2.Rem);
return temp;
}
//*
operator TTT()
{
TTT temp;
temp.r = sqrt(Rem*Rem + Imp*Imp);
if ((Rem == 0 )&&(Imp > 0 ))
{
temp.q = pi/2;
}
else if ((Rem == 0)&&(Imp < 0))
{
temp.q = (3*pi)/2;
}
else
{
temp.q = atan(Imp/Rem);
}
return temp;
}
};
编译环境为vc6.0,两个类有互相使用的关系,为什么有错呢??请高手指点