// complex.h: interface for the complex class.
#include<stdlib.h>
class complex
{
public:
void print();
complex();
complex(float r,float i)
{
real= r;
image= i;
}
virtual ~complex();
friend complex operator + (complex a,complex b);
friend complex operator - (complex a,complex b);
friend complex operator * (complex a,complex b);
friend complex operator / (complex a,complex b);
private:
float image;
float real;
};
/
*********************************************************************
********/
// rational.h: interface for the rational class.
class rational
{
public:
void print(); //输出函数
rational(int x=0,int y=0);
virtual ~rational();
friend rational operator + (rational num1,rational num2); //重载运算
符+
friend rational operator - (rational num1,rational num2);//重载运算符-
friend rational operator * (rational num1,rational num2); //重载运算
符*
friend rational operator / (rational num1,rational num2);//重载运算符/
friend bool operator ==(rational num1,rational num2); //重载运算符
==
friend double real(rational x); //声明转换函数
private: