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

  Describe how the dekf algorithm can be used to train

Describe how the DEKF algorithm can be used to train the simple recurrent network shown in Fig. 15.3 You may also invoke the BPTT algorithm for this training.

  Calculate the positive confidence threshold

Calculate the positive confidence threshold. Use Result 2 to state when the model will make a positive classification.

  Outputs the average of values

Write an algorithm that gets as input three data values x,y, and z and outputs the average of these values if the value of x is positive. If the value of x is either 0 or negative, your algorithm should not compute the average but should print th..

  Product evaluation schedule diagram

Que.1 Draw the product evaluation schedule diagram and briefly describe the importance of product evaluation schedule in software life cycle in your own words.

  How it maps to the 4-input function generators in cbl slice

Show how the ST function can be implemented by a single CLB slice by giving the truth table for the 5-variable function ST(TL, TS, C, Q1, Q0) and show how it maps to the 4-input function generators in the CBL slice.

  Write paper on security privacy and trust issues in internet

Write a research paper about Security, privacy and trust issues in internet. The research paper should contain the following abstract, introduction and refrences. The research paper should be Maximum pages 6.

  What is the difference between veri?cation and validation

What are the advantages of allowing software users to identify and report bugs? What are the disadvantages?

  Extend the definition of the class

i. Overload the operators + and += to perform the stringconcatenation operations. ii. Add the function length to return the length to return thelength of the string.

  Response to an incident involving a computer

Response to an Incident Involving a Computer

  Find the second largest element of a set of n elements drawn

Find the second largest element of a set of n elements drawn from an arbitrary totally ordered set in as small a number of comparisons as possible. Only binary comparisons are allowed.

  Find a path across the grid that avoids bad neighborhoods

Give an O(XY ) algorithm to find the shortest path across the grid that avoids bad neighborhoods. You may assume that all blocks are of equal length. For partial credit, give an O(X2Y2) algorithm.

  Describe the distances along the latitudes

The distance around Earth along a given latitude can be found using the formula C = 2πr cos L, where r is the radius of Earth and L is the latitude. The radius of Earth is approximately 3960 miles.

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