#include <iostream>
using namespace std;
class Imagin{
public:
double x,y;
Imagin(double nx, double ny){
x=nx;y=ny;}
};
int main(){
cout<<"www.moznum.blogspot.com"<<endl<<endl;
double nu1,nu2;
cout <<"First number \n";
cout<< "Enter the real part: ";
cin>> nu1;
cout<< "Enter the imaginary part: ";
cin>> nu2;
Imagin number1(nu1,nu2);
cout << "Second number \n";
double nu3,nu4;
cout<< "Enter the real part: ";
cin>> nu3;
cout<< "Enter the imaginary part: ";
cin>> nu4;
Imagin number2(nu3,nu4);
double real;
real = number1.x +number2.x;
double imagin;
imagin = number2.y + number1.y;
cout <<endl<<"The sum of the complex number is: "<< real << " + "<<imagin<<"i";
return 0;
}
No comments:
Post a Comment