⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maincz.cpp

📁 这是用c++实现的一个复数重载的实例
💻 CPP
字号:
#include<iostream.h>
#include<math.h>
#include "complexcz.h"

void main()
{
	double x,y,x1,y1;
	double x2,y2,x3,y3;
	cout<<"输入四个复数的实部和虚部"<<endl;
	cin>>x>>y>>x1>>y1>>x2>>y2>>x3>>y3;
	Complex a(x,y),b(x1,y1),c,d,e,f;
	Complex g(x2,y2),h(x3,y3);
	Complex i,j,k,l,m;
	cout<<"\nThe first complex a number is  ";
    cout<<a<<endl;
	cout<<"\nThe second complex b number is  ";
	cout<<b<<endl;
	cout<<"\nThe third complex g number is  ";
	cout<<g<<endl;
	cout<<"\nThe forth complex h number is  ";
	cout<<h<<endl;;
	c=a+b;
    cout<<"\nThe sum is ";
	cout<<c<<endl;
	d=a-b;
    cout<<"\nThe sub is ";
	cout<<d<<endl;
	e=a*b;
    cout<<"\nThe mul is ";
    cout<<e<<endl;
    f=a/b;
    cout<<"\nThe div is ";
    cout<<f<<endl;
	g+=a;
	cout<<"\nThe g+=a is";
	cout<<g<<endl;
	h-=a;
    cout<<"\nThe h-=a is";
	cout<<h<<endl;
    i=g++;
    cout<<"\nThe g++ is";
	cout<<i<<endl;
	j=++g;
    cout<<"\nThe ++g is";
	cout<<j<<endl;
	k=h--;
    cout<<"\nThe h-- is";
	cout<<k<<endl;
	l=--h;
    cout<<"\nThe --h is";
	cout<<l<<endl;
	m=a;
	cout<<"\nThe m=a is";
	cout<<m<<endl;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -