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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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