Rather than try to explain my question, I am gonna copy and paste my assignment sheet to avoid confusion.
My question is, while I know how to read a file and store it into an array, I am a little confused on setting up a structure to hold a magnitude and angle. Then creating another array of that new struct type and write a loop to fill it with the magnitudes and angles from the original data array.
2. Practice with arrays and file I/O. Write a program that will read in the complex values stored in the
file impedance.txt that we used in class, writing a new file which contains the magnitude and angle
corresponding to each complex value.
Now, although you do not NEED to use arrays to do this (you could read in one value, then write its
magnitude and angle before going to the next value) I want you to get some practice with arrays!
Might as well practice structures too.
So... read the data into an array of complex values. Define a new struct that would hold a magnitude
and an angle. Create an array of that new struct type, and write a loop to fill it with the magnitudes
and angles from the original data array. Finally, write all those magnitudes and angles into a file, and
print that file as your results.
If anyone can assist and giving me a starting point on this, I would appreciate it greatly.