Exercise 23 - 03/28/2017
A complex number is a number of the form x + iy, where x is the real part, and y is the imaginary part, with i representing the square root of -1. Create a complex number structure called Complex, that contains 2 double data elements - real and img. Write a function called read, that accepts an array of Complex types, the size of the array and reads in the values. In the main function. create an array of 10 Complex variables. Use the read function to read in the values. Then add all the complex numbers and print the sum. (The real and imaginary parts are added separately).
Sample Run:
Enter the 10 complex numbers (only enter x and y):
1 2.2
-4 1.5
3.2 2
8 8
12 1.7
1.9 -5
2.87 2.123
0 2.98
-0.5 -4.72
4.33 4.597
The sum is 28.8 + 15.38i