Define a complex number in c program, C/C++ Programming

Assignment Help:

Define a complex number in c program:

class complex

                                {

 

                                private:

                                int real,ima;

 

                                public :

                                void input();

                                friend complex sum(complex,complex);

                                void show();

                                };

 

 void complex:: show(void)

                {

                 cout << "real part ="<< real << "\nThe imaginary part ="<

                 }

 

 void  complex ::input()

                {

                cout<<"enter the real and imaginary part\n";

                cin >> real >> ima;

                }

 

complex sum( complex a,complex b)

                {

                complex c;

                c.real= a.real + b.real;

                c.ima= a.ima + b.ima;

                return c;

                }

 

void main()

                {

                complex a,b,c;

                clrscr();

                a.input();

                b.input();

                c=sum(a,b);

                c.show();

                getch();

       }


Related Discussions:- Define a complex number in c program

Guidelines or "rules of thumb" for overloading operators?, What are some gu...

What are some guidelines / "rules of thumb" for overloading operators? A: Here are a few guidelines / rules of thumb .Use common sense. If your overloaded operator makes life si

Flowchart.., flowchart of c programing to check the given number is prime o...

flowchart of c programing to check the given number is prime or not

Stuctrue , To store a date use a structure that contains three members date...

To store a date use a structure that contains three members date, month and year. If the dates are equal then display message “Equal” otherwise “Unequal” Program structure: main()

Structures of flowchart, Ask Draw a flowchart that print all even numbers f...

Ask Draw a flowchart that print all even numbers from 2 until 10

Stand-alone dsp application, You are required to write a stand-alone DSP ap...

You are required to write a stand-alone DSP application in the C programming language. The overall objective of this application is to convert a signal from the time domain to t

Files, redirection in c++

redirection in c++

Create a program that converts numbers to characters, People sometimes give...

People sometimes give their phone numbers using one or more alphabetic characters. Create a program that converts the alphabetic characters to their corresponding numbers. For exam

Valid segments 1, Consider text comprised of sentences and sentences compri...

Consider text comprised of sentences and sentences comprised of words. Words in a sentence will be space delimited. Given a text and K strings, task is to find out the number valid

Accessibility, What are the legal requirements with which websites must com...

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd