Question: Write the code in c++. Question 4:Write a program to add, subtract and multiply two complex numbers using structures to function. The functions for addition,

 Write the code in c++. Question 4:Write a program to add,

Write the code in c++.

Question 4:Write a program to add, subtract and multiply two complex numbers using structures to function. The functions for addition, subtraction and multiplication should be separate and each must have a return type. The function names for addition,subtraction and multiplication should be "add","sub" and "multiply" with the return type struct and they all must be inside the structure (Hint: The real part must be added to the real part and complex to complex) Formula: Result->real=(num 1.real*num2.real)-(num 1.imaginary*num2.imaginary) Result->imaginary=(num 1.real*num 2.imaginary)-(num 1.imaginary*num2.real) Prototype of methods: struct complex add(struct complex a, struct complex b); struct complex sub(struct complex a, struct complex b); struct complex multiply(struct complex a, struct complex b)

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!