Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write the int main for the below code in c++ and display it class complex { double real; double imaginary; public: complex() { real =

write the int main for the below code in c++ and display it

class complex

{

double real;

double imaginary;

public:

complex()

{

real = 0;

imaginary = 0;

}

void set_complex(double r,double i)

{

real =r;

imaginary =i;

}

double get_real()

{

return (real);

}

double

get_imaginary()

{

return

(imaginary);

}

char sign(double z)

{

return

((z< 0) ?'-':'+');

}

void display_complex()

{

if

(imaginary == 0)

cout <

else if

(real == 0 && imaginary != 0)

cout << sign(imaginary) << "i"<

else

cout<

}

};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

How many occupied cells must all solution use?

Answered: 1 week ago

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago