
More Programs 241
complex c = complex(a,b);
cout<< “c = ”<< c << “\n”;
cout<< “ and imaginary real part = ” << imag(c) << “\n”;
cout<< “c has complex conjugate = ” << conj(c) << “ \n”;
return 0;
}
OUTPUT
C = (4.5, 7.4)
and imaginary real part = 7.4
c has complex conjugate = (4.5, -7.4)
Explanation: In the above program variable a and b of double data type are declared and ini-
tialized with 4.5 and 7.4. By applying the complex(), imag() ad conj() functions results
are obtained. The results are shown in the output.
7.16 MORE PROGRAMS
7.31 Write a program to convert a float value to integer and char. Invoke overloaded
function show() as per the ...