-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneral.cpp
More file actions
43 lines (34 loc) · 687 Bytes
/
general.cpp
File metadata and controls
43 lines (34 loc) · 687 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
using namespace std;
class addcomplex{
private:
int real;
float imag;
public:
void input(){
cout<<"enter the real part:"<<endl;
cin>>real;
cout<<"enter the imaginary part:"<<endl;
cin>>imag;
}
void output(){
cout<<"("<<real<<","<<imag<<")";
}
addcomplex complex(addcomplex c){
addcomplex temp;
temp.real=c.real+real;
temp.imag=c.imag+imag;
return temp;
}
};
int main(){
addcomplex c1,c2,c3;
c1.input();
c2.input();
c3=c1.complex(c2);
c1.output();
cout<<"+";
c2.output();
c3.output();
return 0;
}