Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This homework assignment requires you to write functions to implement mathematical functions for complex numbers. A complex number consists of a real part and an
This homework assignment requires you to write functions to implement mathematical functions for complex numbers. A complex number consists of a real part and an imaginary part, typically described as a+bi where i is the square root of -1. C++ language
Detailed Description of functions for all of the code examples below, assume all variables are of type The complexPO function should output the value of the givae. with an "r ater the imaginary term. There should be no spaces or in before or after the output Note: a specification like +.21ts is very handy for the imaginary part print 5.20-7 30 prints ?2 . ,99; y.-5.0, compleXP ( ?.y); // 3.00-5.001 The complex3 function takes an integer operator and three complex numbers (six doubles); it provides the result of the operation (1-add, 2 sub, 3-mult) Some examples -1.2: b-3.4: -5.6:d-7.8 prints.80+ i1.20i prints prints -3.00-4.0s prints -32-00-2900 co plex) (1,6e,6f.a,b, e, d)?eemplex, le. t) a.1.2; b.3.4; // : d-9 corpiex3 12,se,&E,a,b, e,d) :complexple.t) The complex3 () function takes seven (7) arguments as follows - operator designation- 1 add, 2-sub; 3 mult: other-print error - address of real part of result - address of imaginary part of result - real part of operand1 - imaginary part of operand 1 - real part of operand 2 - imaginary part of operand 2 The complex2( function takes an integer operator and two complex numbers (four doubles). The first set of values are both one of the operands and where the result will be placed. The operator has the same meaning as in complex30. Some examples: a 1.2; b-3.4: c 5.6: d7.8 complex2 (a. a,ab, c,d) :complexPla,b) // prints 6.80-11.201 a1.2; b-3.4; c.-5.6; ds-9.0; complexz (1, sa, b,e,d) :complexPla,b) / prints -4.40-5.60 a 2.0: b 3.0: c 5.0: d-7.0 complexz (2, sa, &b, c, d) complexP(a,b) / prints -3.00-4.00i a 2.0: b-3.0: c 5.0: d 7.0 complexz (3, &a, sb,c,d):complexP(a,b) /prints -11.00+29.001 The complex2 () function takes five (5) arguments as follows: -operator designation - 1-add, 2-sub; 3-mult, other-print error - address of real part of result and first operand - address of imaginary part of result and first operand -real part of operand 2 - imaginary part of operand2 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started