complex类

#include 
#include 
using namespace std;
class complex{
    public:
        complex(double real1=0,double imaginary1=0);
        complex(complex &t);
        void add(complex a);
        void show();
        double mod();
    private:
        double real;
        double imaginary;
};
complex::complex(double real1,double imaginary1){ 
    real=real1;
    imaginary=imaginary1;
}
complex::complex(complex &t){
    real=t.real;
    imaginary=t.imaginary;
}
void complex::add(complex a){
    real=real+a.real;
    imaginary+=a.imaginary;
}
void complex::show(){
    cout<

  complex类_第1张图片

 

转载于:https://www.cnblogs.com/wsggwsc/p/10645354.html

你可能感兴趣的:(complex类)