cutiekatrusjen2690 cutiekatrusjen2690
  • 30-04-2021
  • Computers and Technology
contestada

Define a class Complex to represent complex numbers. All complex numbers are of the form x + yi, where x and y are real numbers, real numbers being all those numbers which are positive, negative, or zero.

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 02-05-2021

Answer:

The program in C++ is as follows:

#include<bits/stdc++.h>

using namespace std;

class Complex {

public:

 int rl, im;

Complex(){ }

Complex(int Real, int Imaginary){

 rl = Real;  im = Imaginary;

}

};

int main(){

   int real, imag;

   cout<<"Real: ";    cin>>real;

   cout<<"Imaginary: ";    cin>>imag;

Complex ComplexNum(real, imag);

cout<<"Result : "<< ComplexNum.rl<<" + "<<ComplexNum.im<<"i"<<endl;

}

Explanation:

See attachment for explanation

Ver imagen MrRoyal
Answer Link

Otras preguntas

please tell me a answer please and thank you and please show steps =^)
Can someone help me please? ASAPPlease answer if you are sure.THANKS
Looking at the effects and consequences of illegal drinking, what advice would you give an 11-year-old brother or sister? List at least three effects/consequenc
At the amusement park, billy rode the ferris wheel seven times. if each ride cost 5 tickets to get on, how many tickets did he use?
Oh need help if you can help that would be amazing
What microscope is used to study dna molecules? TEM SEM STM
For acidic solutions, which element is added to balance half-reactions? A. hydrogen B. hydroxide C. oxygen D. nitrogen
Please help with this question.
Um corpo e impulsionado no vacuo sobre um plano horizontal sem atrito por uma forca paralela ao plano que atua instantaneamente sobre ele neste caso pode-se con
What was Joe Zawinul’s key contribution to jazz?