Using Mathematical Operators for complex

With these operators, you can code expressions on complex numbers such as the expressions shown in the example below. In the example, for each complex scalar x, the comments showing the results of operations use xr to denote the scalar's real part and xi to denote the scalar's imaginary part.

//   Using the complex mathematical operators
 
#include <complex.h>
#include <iostream.h>
 
complex a,b,c,d,e,f,g;
 
void main() {
   cout << "Enter six complex numbers, separated by spaces:\n";
   cin >> b >> c >> d >> e >> f >> g; 
   // assignment, multiplication, addition
   a=b*c+d; // a=( (br*cr)-(bi*ci)+dr , (br*ci)+(bi*cr)+di )
   // division
   a=b/d; // a=( (br*dr)+(bi*di) / ((br*br)+(bi*bi),
          //     (bi*dr)-(br*di) / ((br*br)+(bi*bi) ) 
   // subtraction
   a=b-f; // a=( (br-fr), (bi-fi) )
   // equality, multiplication assignment
   if (a==f) c*=e; // same as c=c*e; 
   // inequality, addition assignment
   if (b!=f) d+=g; // same as d=d+g;
   cout << "Here are the seven numbers after calculations:\n"
        << "a=" << a << '\n'
        << "b=" << b << '\n'
        << "c=" << c << '\n'
        << "d=" << d << '\n'
        << "e=" << e << '\n'
        << "f=" << f << '\n'
        << "g=" << g << endl;
} 

This example produces the output shown below in regular type, given the input shown in bold:

Enter six complex numbers, separated by spaces:
(1.14,2.28) (2.24,4.48) (1.17,12.18)
(4.4444444,5.12341) (12,7) 5
Here are the seven numbers after calculations:
a=( -10.86, -4.72)
b=( 1.14, 2.28)
c=( 2.24, 4.48)
d=( 6.17, 12.18)
e=( 4.44444, 5.12341)
f=( 12, 7)
g=( 5, 0)

Note that there are no increment or decrement operators for complex numbers.