Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Jian xLab10 (1).pdt '. Microsoft Word-lab5.docx x,A 1-??-???? X ( :x; C++ Programming Langue-x : Q Why do we use typedet stru x C
Jian xLab10 (1).pdt '. Microsoft Word-lab5.docx x,A 1-??-???? X ( :x; C++ Programming Langue-x : Q Why do we use typedet stru x \ C O file:///users/Jason/Downloads/Lab10%20(1).pdf ? ????? ::?? 0750 ????? _???????? Computer Science g Learn HTML: Eleme 3 waschools Online. ~ C++ Language-C . ? C++ Environment S . ]???? >> Lab10 (1).pdf 1 /2 Lab 10 Name: Q1. Create a class to perform addition operation on complex data. The program should ask for real and imaginary part of two complex numbers, and display the real and imaginary parts of their sum. Note: Declare a class with two private double type member variables for the real and imaginary parts respectively. Define a constructor taking two arguments of doubles for the real and imaginary parts respectively. Define two functions named get ri and get-im for returning the real and imaginary parts respectively. In the main function, input two complex numbers, each with real and imaginary parts respectively, e.g. nul and nu2 for the first complex number (comp1) and nu3 and nu4 for the second complex number (comp2). Build two complex number objects, and perform addition operation, by adding their real and imaginary parts (double real = comp 1.get_rl() +comp2.get_T);double imagina comp1.get im)+ comp2.get im0:), and then print the sum of the two complex numbers (print real and imagin respectively)
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