Source Code:
#include<iostream>
using namespace std;
class Complex{
private:
int real;
int imagi;
public:
void input()
{
cout<<"enter the real part: "<<" "<<endl;
cin>>real;
cout<<"enter the imaginary part: "<<" "<<endl;
cin>>imagi;
}
void display()
{cout<<real<<"+"<<imagi<<"i"<<endl;
}
};
int main()
{Complex c1,c2;
c1.input();
c2.input();
cout<<"complex number is"<<" "<<endl;
c1.display();
c2.display();
return 0;
}
0 Comments
Post a Comment