#include
class Complex
{
public:
int real,imaginary;
void complex(int x,int y)
{
real=x;
imaginary=y;
}
};
void add(int x,Complex y)
{
int r,i;
r=y.real;
i=y.imaginary;
Complex t;
t.real=x+r;
t.imaginary=i;
cout<<"result is : "< return; } void add(Complex x,Complex y) { Complex t; t.real=x.real+y.real; t.imaginary=x.imaginary+y.imaginary; cout<<"result is : "< return; } void main() { Complex s1,s2; int s3,t1,t2; int choice=1; while(choice<=2) { cout<<"1. Add a real number and a complex number\n"; cout<<"2. Add two complex numbers\n"; cin>>choice; switch(choice) { case 1: cout<<"Enter the first integer\n"; cin>>s3; cout<<"Enter the real part of the Complex number\n"; cin>>t1; cout<<"Enter the imaginary part of the complex number\n"; cin>>t2; s1.complex(t1,t2); add(s3,s1); break; case 2: cout<<"Enter the real part of the first Complexnumber\n"; cin>>t1; cout<<"Enter the imaginary part of the first complex number\n"; cin>>t2; s1.complex(t1,t2); cout<<"Enter the real part of the second Complex number\n"; cin>>t1; cout<<"Enter the imaginary part of the second complex number\n"; cin>>t2; s2.complex(t1,t2); add(s1,s2); break; } } }