Hi evry one im new to this and C programming and looking for any one to help me with my asignment as I have no idea what to do......so i have to build a program to do with complex numbers ......i have to be able to convert them from rectangular form to circular and back again.....I will pm all the detail if any one is willing to help out......any help is apreciated thanks.
Code: #include <math.h> struct complex_rectangular { double real; double imaginary; }; struct complex_polar { double absolute; double argument; // angle in radians }; typedef struct complex_rectangular complex_rectangular_t; typedef struct complex_polar complex_polar_t; complex_polar_t convertRectangularToPolar(complex_rectangular_t rectangular) { complex_polar_t polar; polar.absolute = sqrt(pow(rectangular.real, 2) + pow(rectangular.imaginary, 2)); polar.argument = atan(rectangular.imaginary / rectangular.real); return polar; } complex_rectangular_t convertPolarToRectangular(complex_polar_t polar) { complex_rectangular_t rectangular; rectangular.real = polar.absolute * cos(polar.argument); rectangular.imaginary = polar.absolute * sin(polar.argument); return rectangular; }
Hi DRK thank you very much ....sorry for such a late reply i had no access to the net was away for a while ....once again thank you very much im gone try to run that and i will get back to you in a bit