📅  最后修改于: 2022-03-11 14:52:19.653000             🧑  作者: Mango
#include
using namespace std;
class Complex
{
private:
float real,img;
public:
Complex()
{
real=0;
img=0;
}
void accept()
{
cout<<"Enter the complex number:"<<"\n";
cout<<"Real:";
cin>>real;
cout<<"Imaginary:";
cin>>img;
}
void display()
{
cout<<"complex number is:";
cout<>ch;
switch(ch)
{
case 1: cout<<"Addition:";
//c3=c4+c5;
c3=operator+(c4,c5);
c3.display();
cout<<"\n";
break;
case 2: cout<<"Substraction:";
// c3=c4-c5;
c3=operator-(c4,c5);
c3.display();
cout<<"\n";
break;
case 3: cout<<"Multication:";
c3=c4*c5;
//c3=c4.operator*(c5);
c3.display();
cout<<"\n";
break;
case 4: cout<<"Division:";
// c3=c4/c5;
c3=c4.operator/(c5);
c3.display();
cout<<"\n";
break;
default:
cout<<"EXIT";
}
}while(ch<=4);
return 0;
}