Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- struct complex
- {
- double re;
- double im;
- }z,x;
- void citire(struct complex&z)
- {
- cin>>z.re>>z.im;
- }
- void scriere (struct complex&z)
- {
- if(z.im>0)
- {
- cout<<z.re<<"+"<<z.im<<"*i";
- }
- if(z.im<0)
- {
- cout<<z.re<<z.im<<"*i";
- }
- if(z.im==0)
- {
- cout<<z.re;
- }
- }
- int main ()
- {
- citire(z);
- scriere(z);
- citire(x);
- scriere(x);
- int s=0,s1=0;
- if(x.re>=0&&x.im>=0&&z.re>=0&&z.im>=0)
- {
- s=x.re+z.re;
- s1=x.im+z.im;
- }
- cout<<s<<"+"<<s1<<"*i";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement