Question: Time it took Matthew: 5 mins File(s) to submit: complex_mult.c Requriements: Program must compile with both -Wall and -Werror options enabled Submit only the files

Time it took Matthew: 5 mins

File(s) to submit: complex_mult.c

Requriements:

Program must compile with both -Wall and -Werror options enabled

Submit only the files requested

Use doubles to store real numbers

Print all doubles to 2 decimal points unless stated otherwise

Problem Description

Multiply two complex numbers together. Complex numbers have the form A*i + B where

A is the imaginary part of the number

B is the real part of the number

i is the imaginary unit and i * i = -1

Your program should ask the user for 2 complex numbers, multiply them together, and then display the result.

Assumptions

All input is valid

The examples provided do not represent all possible input you can receive

So make sure to test throughly on your machine

Additional Notes

There can be any number of spaces between a, the plus sign, b, and i and your program should be able to handle this

Examples

In the examples below user input has been underlined. You don't have to do any underlining in your program. It is just there to help you differentiate between what is input and what is output.

Example 1

Enter the first complex number in the form ai + b: 5i + 3

Enter the second complex number in the form ai + b: 2i + 4

(5i + 3) * (2i + 4) = 26i + 2

Example 2

Enter the first complex number in the form ai + b: 10 i + 3

Enter the second complex number in the form ai + b: 6i+1

(10i + 3) * (6i + 1) = 28i + -57

Example 3

Enter the first complex number in the form ai + b: 1i+2

Enter the second complex number in the form ai + b: 3 i + 4

(1i + 2) * (3i + 4) = 10i + 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!