++ programming one of the image is what the output of the code is supposed to be. please use these if possible: #include using namespace std; other stuff such as #include doesn't work on my compiler. Please help me with this program. Thanks!

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question

c++ programming

one of the image is what the output of the code is supposed to be.

please use these if possible:

#include <iostream>

using namespace std;

other stuff such as #include <conio.h> doesn't work on my compiler.

Please help me with this program. Thanks!

Classes and operator overloading
Define a class for complex numbers. A complex number is a number of the
form:
a + b*i where
for
purposes,
and b are numbers
of type
our
a
double
and i is a number that represents the quantity v-1 (i * i = -1).
Represent
a complex number
two
values
of
type double.
Name
the
as
member variables real and imaginary. (The variable for the number that
is multiplied by i
is
the
called imaginary.)
Call
the
class
one
Complex.
Include a constructor with two parameters of type double that can be
used to set the member variables of an object to any values.
Include
constructor
that
has
only a single parameter
of
type
a
double ;
call this parameter realPart and define the constructor so
that the object will be initialized
to realPart + 0*i .
Include a
default constructor that initializes an object to 0 (that is, to 0 +
0*i).
Overload all the following operators
so
that they correctly apply to
the type Complex: +, -, *, «, (>> optinal)
The sum of The product of two complex numbers is given by the
following formula: (a + b*i)+(c + d*i) =
(a+c)+ (b+d) *i
The difference of The product of two complex numbers is given by the
following formula:
(а + b*i)-(с+d*i) %3
(а-с)+ (b-d) *i
The product of two complex numbers is given by the following
formula:
(a + b*i)* (c + d*i) =
(a*c
b*d) + (a*d + b*c) *i
You should also write a test program:
Instantiate four complex numbers C1=(1+4*i), C2=(-3-7i), C3= (4*i)and
C4= (-3+ i)
Add, subtract and multiply Cl and C2.
Add, subtract and multiply C3 and C4.
Use the overloaded « to display the result of the three operations
as follow:
Transcribed Image Text:Classes and operator overloading Define a class for complex numbers. A complex number is a number of the form: a + b*i where for purposes, and b are numbers of type our a double and i is a number that represents the quantity v-1 (i * i = -1). Represent a complex number two values of type double. Name the as member variables real and imaginary. (The variable for the number that is multiplied by i is the called imaginary.) Call the class one Complex. Include a constructor with two parameters of type double that can be used to set the member variables of an object to any values. Include constructor that has only a single parameter of type a double ; call this parameter realPart and define the constructor so that the object will be initialized to realPart + 0*i . Include a default constructor that initializes an object to 0 (that is, to 0 + 0*i). Overload all the following operators so that they correctly apply to the type Complex: +, -, *, «, (>> optinal) The sum of The product of two complex numbers is given by the following formula: (a + b*i)+(c + d*i) = (a+c)+ (b+d) *i The difference of The product of two complex numbers is given by the following formula: (а + b*i)-(с+d*i) %3 (а-с)+ (b-d) *i The product of two complex numbers is given by the following formula: (a + b*i)* (c + d*i) = (a*c b*d) + (a*d + b*c) *i You should also write a test program: Instantiate four complex numbers C1=(1+4*i), C2=(-3-7i), C3= (4*i)and C4= (-3+ i) Add, subtract and multiply Cl and C2. Add, subtract and multiply C3 and C4. Use the overloaded « to display the result of the three operations as follow:
7*i)
7*i)
|(1 + 4*i) + (-3
|(1 + 4*i)
|(1 + 4*i) * (-3 - 7*i)
(4*i) + (-3 + i)
(4*i)
|(4*i)
-2
3*i
%3D
(-3
4 + 11*i
-
%3D
25
19*i
-3 + 5*i
%3D
(-3 + i)
(-3 + i)
3 + 3*i
=
-4
12*i
%3D
||
||
Transcribed Image Text:7*i) 7*i) |(1 + 4*i) + (-3 |(1 + 4*i) |(1 + 4*i) * (-3 - 7*i) (4*i) + (-3 + i) (4*i) |(4*i) -2 3*i %3D (-3 4 + 11*i - %3D 25 19*i -3 + 5*i %3D (-3 + i) (-3 + i) 3 + 3*i = -4 12*i %3D || ||
Expert Solution
steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Basics of loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning