Complex number calculator

Assignment Help Basic Computer Science
Reference no: EM131406600

C programming

Complex Number Calculator

Create a complex number calculator (For a brief overview on complex numbers, take a look at https://mathworld. wolfram.com/ComplexNumber.html). Your calculator should be able to compute the following:

  • Addition of two complex numbers: z1 + z2
  • Subtraction of two complex numbers: z1 - z2
  • Multiplication of two numbers: z1 z2
  • Division of two complex numbers: z1 z2
  • Computation of the magnitude and phase (in degrees) of a complex number z. 1

The program should ask the user which of the five operations he wants to perform. It then asks the user to enter the appropriate values for the complex numbers and performs the necessary computation. Your program should execute continuously until the user requests to terminate it.

Sample run:

Press + for addition, - for subtraction, * for multiplication, / for division, m for magnitude and phase, or any other key to exit: +

Enter a complex number: 2 5

Enter a complex number: 1 8

(2+5i)+(1+8i)=(3+13i)

Press + for addition, - for subtraction, * for multiplication, / for division, m for magnitude and phase, or any other key to exit: n

Your program should include the following functions:

1. Void read complex(float *z r, float *z i) // reads a complex number from the keyboard

2. Void print complex(float z r, float z i) // prints a float number on the screen in the form a+bi

3. Void add complex(float z1 r, float z1 i, float z2 r, float z2 i, float *z3 r, float *z3 i) // z3=z1+z2

4. Void sub complex(float z1 r, float z1 i, float z2 r, float z2 i, float *z3 r, float *z3 i) // z3=z2-z1

5. Void mul complex(float z1 r, float z1 i, float z2 r, float z2 i, float *z3 r, float *z3 i) // z3=z1· z2

6. Void div complex(float z1 r, float z1 i, float z2 r, float z2 i, float *z3 r, float *z3 i) // z3=z1 z2

7. Void par complex(float z1 r, float z1 i, float *mag, float *ph) // magnitude and phase

Reference no: EM131406600

Questions Cloud

Determine the resulting number of bits for a piece of music : In a CD player, the sampling rate is 44.1 kHz, and the samples are quantized using a 16 bit/sample quantizer. Determine the resulting number of bits for a piece of music with a duration of 50 minutes.
Standard bluetooth communication on an iphone : What type of antenna is used for standard Bluetooth communication on an iPhone? What are some drawbacks of this design?
File signature verification tool provides : Enumerate the information about system files and device driver files that the File Signature Verification tool provides.
Discussion and dropbox assignment : In a professional environment, you typically create three interface-layout designs and show them to the client. Then, the client and you, together, select one of these designs. The complete website development is based on this design.
Complex number calculator : Complex Number Calculator Create a complex number calculator (For a brief overview on complex numbers, take a look at http://mathworld. wolfram.com/ComplexNumber.html). Your calculator should be able to compute the following:
Discuss about the is strategic plan : Using the IS alignment work and the financial analysis from, submit a complete IS strategic plan. Your paper should include at least 5 references from peer-reviewed journals associated with how other companies are using the technologies you are re..
Calculate the average price at which the shares were issued : Common stock without par value 1,500,000 shares authorized 500,000 shares issued and 540,000 shares outstanding $8,700,000. Required: Calculate the average price at which the shares were issued
What is the power in this process : Assume that-this signal is transmitted using a uniform PCM system with 512 quantization levels, what is the resulting SQNR in decibels and what is the minimum required transmission bandwidth if in sampling the signal a guard band of 1 kHz is used?
Information technology foundations : This is an open-book individual examination. You may use any resources in addition to the course materials, such as other books, articles, and the Web. However, you must do your own work and you may not collaborate with your classmates.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  The security administrator of a major organization

You have just been hired as the security administrator of a major organization that was recently breached by a social engineer. After a thorough analysis of the network security, you have determined that there was no security plan in place and ..

  Does the choice in lzrw1 satisfy these criteria

The hash function used in LZRW1 can be found in Appendix B. Knuth [39] writes that such functions should be quick to compute and should minimize collisions. Does the choice in LZRW1 satisfy these criteria? The constant 40543 which appears in the d..

  Human resources business processes

Currently several of their support departments are using manual processes and they wish to automate their accounting and human resources business processes.

  Identify a circle and move towards it

identify a circle and move towards it

  Develop a sequence of instructions that adds the 8 digit

Develop a sequence of instructions that adds the 8 digit BCD number in AX and BX to the 8 digit BCD number in CX and DX. (AX and CX are the most significant registers. The results must be found in CX and DX after the addition).

  What are the trade-off s with this method

What are the trade-off s with this method?

  Print this listing table only in landscape mode

Print this Listing table ONLY in landscape mode. In Page Setup, print the table to fit to 1 page wide by 2 pages tall. Your printout should contain only the Listing table including the Totals Row.

  Describe two sampling methods to select independent groups

Describe two sampling methods to select independent groups

  Show that the class of turing reductions is transitive

The class of polynomial-time Turing reductions are Turing reductions in which the OTM runs in time polynomial in the length of its input. Show that the class of Turing reductions is transitive.

  How many different security codes are possible

Suppose the homeowner does not want to use 0 as one of the digits and wants only two of the digits to be odd. How many codes can be formed if the digits can be repeated? If no repetitions are allowed, how many codes are available?

  How will decision meet accessibility guidelines

Knowing that this violates Redundancy Principle, but wanting to accommodate employees with disabilities, what would you suggest instead? How would your decision meet accessibility guidelines?

  Discuss the concept of polymorphism/operator overloading

What is the difference between persistent and transient objects? How is persistence handled in typical 00 database systems?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd