4. Then we can write (x + jy)" as R"emo and go back to write the result as R"elme as (R"co s(n0) + jR" sin(n0))

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter3: Assignment, Formatting, And Interactive Input
Section3.3: Using Mathematical Library Functions
Problem 5E: (General math) Write, compile, and run a C++ program to calculate the distance between two points...
icon
Related questions
Question
Solve problem 4,in a c program
Problem:
1. Define a C structure complx for a complex number with two data
members for the (real, imaginary) real and imaginary parts of the
complex number. It should be able to handle any real numbers! Use
typedef to make your program readable.
2. What we want to do next is to write a procedure to raise any complex
number to any integer power
(x + jy)"
Where x and y are real number and n is an integer!
3. What we want to do next is write (x + jy)as Re1e
where R = (x2 + y² ) and tan-1(0) = (2)
4. Then we can write (x + jy)" as R"eino and go back to write the result
as R"eime as (R"co s(n0) + jR" sin(n0))
5. In your procedure (function) you will use for-loop to compute the value
of R". If you remember, we wrote very efficient programs to compute
the sin(x) and cos(x) functions. You may use those or include the
math library header file and use the trig functions
[sin( ), cos( ) and tan( )]
and the square-root functions only!
6. Note that the tan(x) is multi-valued. So you should check to see that
you are in the right quadrant!
7. The function should print the result on the screen in the form
Ans: ( x, jy) which should also be the value returned by the function to
main().
Be Very Happy.
Transcribed Image Text:Problem: 1. Define a C structure complx for a complex number with two data members for the (real, imaginary) real and imaginary parts of the complex number. It should be able to handle any real numbers! Use typedef to make your program readable. 2. What we want to do next is to write a procedure to raise any complex number to any integer power (x + jy)" Where x and y are real number and n is an integer! 3. What we want to do next is write (x + jy)as Re1e where R = (x2 + y² ) and tan-1(0) = (2) 4. Then we can write (x + jy)" as R"eino and go back to write the result as R"eime as (R"co s(n0) + jR" sin(n0)) 5. In your procedure (function) you will use for-loop to compute the value of R". If you remember, we wrote very efficient programs to compute the sin(x) and cos(x) functions. You may use those or include the math library header file and use the trig functions [sin( ), cos( ) and tan( )] and the square-root functions only! 6. Note that the tan(x) is multi-valued. So you should check to see that you are in the right quadrant! 7. The function should print the result on the screen in the form Ans: ( x, jy) which should also be the value returned by the function to main(). Be Very Happy.
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning