Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions