Advertisement
Alex_Fuleki21

c,d,e

Mar 14th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. struct complex
  5. {
  6. double re;
  7. double im;
  8. }z,x;
  9. void citire(struct complex&z)
  10. {
  11. cin>>z.re>>z.im;
  12. }
  13. int sumar(struct complex x,struct complex z)
  14. {
  15. double s=0;
  16. s=s+(x.re+z.re);
  17. return s;
  18. }
  19. int sumai(struct complex z,struct complex x)
  20. {
  21. double s1=0;
  22. s1=s1+(x.im+z.im);
  23. return s1;
  24. }
  25. int difr(struct complex x,struct complex z)
  26. {
  27. double d=0;
  28. d=d+(x.re-z.re);
  29. return d;
  30. }
  31. int difi(struct complex z,struct complex x)
  32. {
  33. double d1=0;
  34. d1=d1+(x.im-z.im);
  35. return d1;
  36. }
  37. int produsr(struct complex z,struct complex x)
  38. {
  39. double p=0;
  40. p=p+(x.re*z.re);
  41. return p;
  42. }
  43. int produsi(struct complex z,struct complex x)
  44. {
  45. double p1=0;
  46. p1=p1+(x.im*z.im);
  47. return p1;
  48. }
  49. int main()
  50. {
  51. citire(x);
  52. citire (z);
  53. if(sumai(x,z)>0)
  54. {
  55. cout<<sumar(x,z)<<"+"<<sumai(x,z)<<"*i"<<endl;
  56. }
  57. if(sumai(x,z)<0)
  58. {
  59. cout<<sumar(x,z)<<sumai(x,z)<<"*i"<<endl;
  60. }
  61. if(difi(x,z)>0)
  62. {
  63. cout<<difr(x,z)<<"+"<<difi(x,z)<<"*i"<<endl;
  64. }
  65. if(difi(x,z)<0)
  66. {
  67. cout<<difr(x,z)<<difi(x,z)<<"*i"<<endl;
  68. }
  69. if(produsi(x,z)!=0)
  70. {
  71. cout<<produsr(x,z)<<"+"<<produsi(x,z)<<"*i"<<endl;
  72. }
  73. }
  74. int maxre(struct complex z,struct complex x)
  75. {
  76. double m1r,m2r;
  77. m1r=m1r+sqrt(z.re*z.re);
  78. m2r=m2r+sqrt(x.re*x.re);
  79. if(m1r>m2r)
  80. {
  81. return z.re;
  82. }
  83. else
  84. {
  85. return x.re;
  86. }
  87. }
  88. int maxim(struct complex z,struct complex x)
  89. {
  90. double m1i,m2i;
  91. m1i=m1i+sqrt(z.im*z.im);
  92. m2i=m2i+sqrt(x.im*x.im);
  93. if(m1i>m2i)
  94. {
  95. return ;
  96. }
  97. else
  98. {
  99. return m2i;
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement