CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
using namespace std;
struct complex_number
{
double realnumber;
double imaginarynumber;
};
void accept(complex_number,complex_number);
void display(complex_number,complex_number);
int main()
{
complex_number c1;complex_number c2;
accept(c1,c2);
display(c1,c2);
return 0;
}
void accept(complex_number c1,complex_number c2)
{
cout<<"For first complex number :"<<endl;
cout<<"Enter real part"<<" ";cin>>c1.realnumber;
cout<<"Enter imaginary part"<<" ";cin>>c1.imaginarynumber;
cout<<endl;
cout<<"For second complex number :"<<endl;
cout<<"Enter real part"<<" ";cin>>c2.realnumber;
cout<<"Enter imaginary part"<<" ";cin>>c2.imaginarynumber;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run