Answer:
#include <iostream>
using namespace std;
struct complex{//structure of comlex number..
double real;
double img;
};
complex make_complex(double a,double b)//function to return complex number with two arguments of type double..
{
complex n1;
n1.real=a;
n1.img=b;
return n1;//returning complex number..
}
int main() {
complex n;
double a,b;
cout<<"Enter real and Imaginary respectively"<<endl;
cin>>a>>b;//taking input of real and imaginary parts..
n=make_complex(a,b);//calling function..
cout<<"Comlex number is : "<<n.real<<" + i"<<n.img;//printing the output..
return 0;
}
output:-
Enter real and Imaginary respectively
5.4 8.9
Comlex number is : 5.4 + i8.9
Step-by-step explanation:
First I have created a structure for complex number.Then created a function to make complex number according to the question which returns a complex number.