偶然翻到之前上面向对象程序设计实验课做的作业,po出来一下,相信以后还会有人学到并写到。
#include<iostream>
#include<stdlib.h>
using namespace std;
class Complex{
public:
Complex(double r=0.0,double i=0.0)
{
real=r;imag=i;}
Complex operator+(const Complex &c2)const;
Complex operator-(const Complex &c2)const;
void display()const;
Complex operator*(const Complex &c2)