P
putzihung
Hello,
Ich kann nicht so gut in Deutsch schreiben, weil ich nur voruebergehend hier studiere. Ich have eine Aufgabe, die ich loesen muss. Seid jemand so nett und help me to solve it. I appreciate you guys a lot:
1. Complex numbers are numbers which have both a real part and an imaginary part. Complex numbers are used extensively in Electrical Engineering for representing impedance, voltage, and current in AC circuits.
Complex numbers are represented in two ways:
Rectangular Form: X = a + bj <--- (real) + (imaginary) j
Polar Form: X = M / f
Create a structure to store a complex number in Rectangular Form. Both the real and imaginary parts should be of type float.
Next write the following functions:
For example the function “show” should print like: 5 + 10j or 5 - 10j
Your main() function should prompt the user to enter two complex numbers. The user will have to enter four floats. Test the two function, show() and add().
2. Write a function that computes the length of a string. Do not just use the strlen() function that exist in the library to do this.
ex. char name[] = “Cindy Lou Who”;
If your function is called str_length(), then
str_length(name); will return the integer 13, since there are 13 characters in the string “Cindy Lou Who”.
Ich kann nicht so gut in Deutsch schreiben, weil ich nur voruebergehend hier studiere. Ich have eine Aufgabe, die ich loesen muss. Seid jemand so nett und help me to solve it. I appreciate you guys a lot:
1. Complex numbers are numbers which have both a real part and an imaginary part. Complex numbers are used extensively in Electrical Engineering for representing impedance, voltage, and current in AC circuits.
Complex numbers are represented in two ways:
Rectangular Form: X = a + bj <--- (real) + (imaginary) j
Polar Form: X = M / f
Create a structure to store a complex number in Rectangular Form. Both the real and imaginary parts should be of type float.
Next write the following functions:
- Write a “show” function that displays the complex number in rectangular form. In other words, this function should accept the complex number as an argument and then display the number showing the ‘+/-‘ and the ‘j’.
For example the function “show” should print like: 5 + 10j or 5 - 10j
- Write an “add” function that adds two complex numbers together. This function should accept two complex numbers as arguments and return the complex sum.
Your main() function should prompt the user to enter two complex numbers. The user will have to enter four floats. Test the two function, show() and add().
2. Write a function that computes the length of a string. Do not just use the strlen() function that exist in the library to do this.
ex. char name[] = “Cindy Lou Who”;
If your function is called str_length(), then
str_length(name); will return the integer 13, since there are 13 characters in the string “Cindy Lou Who”.