#include #include #include using namespace std; class Complex { private: int real; int imaginary;
#include #include #include using namespace std; class Complex { private: int real; int imaginary;
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
QUESTION PROVIDED IN ATTACH IMAGE KINDLY SEE. PROVIDE OUTPUT AS IT IS SHOWN IN QUESTION.
AND BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , complex.cpp )
----------------- TEMPLATES BELOW FOR SOLUTION -----------------------
complex.cpp
#include<cstring> class Complex
|
Main.cpp
#include<cstring> #include<iostream> #include<string> #include "Complex.cpp" using namespace std; int main() { //fill your code here } |
![Develop a program to overload binary operators.
The class Complex has the following public attributes
Data type
int
int
Variable name
real
imaginary
Include default constructor to initialize real and imaginary values to 0
Include the following functions in the Complex class and overload the binary operators
Member function
void getvalue()
Function description
This function is used to read inputs
This function will add the real and imaginary parts
and return the complex object of added values
Complex operator+(const Complex& obj)
This function will subtract the real and imaginary parts
and return the complex object of subtracted values
Complex operator-(const Complex& obj)
void display()
This function will display the result value
In main() function invoke the operator overloading by creating objects for the Complex class. Below
statements should be printed in the main() function itself
• Enter the value of Complex Numbers a,b:
• Enter the value of Complex Numbers a,b:
• Input Values :
• Result :
Sample Input and Output:
[All texts in bold represents input and rest represents output statements]
Enter the value of Complex Numbers a,b:45
Enter the value of Complex Numbers a,b:78
Input Values:
Output Complex number:4+5i
Output Complex number :7+8i
Result :
Output Complex number :11+13i
Output Complex number : -3-3i](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F207d1139-23ae-479d-8e88-0330a5a9ebcb%2F19a333d3-1e4d-47f7-ae6a-9a2d6b7f1b35%2Fvwjuy2e_processed.png&w=3840&q=75)
Transcribed Image Text:Develop a program to overload binary operators.
The class Complex has the following public attributes
Data type
int
int
Variable name
real
imaginary
Include default constructor to initialize real and imaginary values to 0
Include the following functions in the Complex class and overload the binary operators
Member function
void getvalue()
Function description
This function is used to read inputs
This function will add the real and imaginary parts
and return the complex object of added values
Complex operator+(const Complex& obj)
This function will subtract the real and imaginary parts
and return the complex object of subtracted values
Complex operator-(const Complex& obj)
void display()
This function will display the result value
In main() function invoke the operator overloading by creating objects for the Complex class. Below
statements should be printed in the main() function itself
• Enter the value of Complex Numbers a,b:
• Enter the value of Complex Numbers a,b:
• Input Values :
• Result :
Sample Input and Output:
[All texts in bold represents input and rest represents output statements]
Enter the value of Complex Numbers a,b:45
Enter the value of Complex Numbers a,b:78
Input Values:
Output Complex number:4+5i
Output Complex number :7+8i
Result :
Output Complex number :11+13i
Output Complex number : -3-3i
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY