Create complex number using constructor , C/C++ Programming

Create Complex number using constructor:

class complex




                                                int real,ima;

                                                static int count;

                                                public :


                                                complex (int a,int b)       //constructor





                                                complex()      //default constructor





                                                void show()


                                                cout<< real<<"\n"<



                                                friend complex sum(complex ,complex);


                                                ~complex () // destructor




                                int complex :: count=15;


                complex sum( complex a,complex b)


                complex c3;

                c3.real= a.real + b.real;

                c3.ima= a.ima + b.ima;

                return c3;



void main()


                complex a,b,c;


                a = complex(10,12);   //constructor

                b= complex(12,10);



                //cout <




Posted Date: 10/18/2012 6:38:39 AM | Location : United States

Related Discussions:- Create complex number using constructor , Assignment Help, Ask Question on Create complex number using constructor , Get Answer, Expert's Help, Create complex number using constructor Discussions

Write discussion on Create complex number using constructor
Your posts are moderated
Related Questions

Program is to read the contents of a file: void main()    {   ifstream fin("ascii.txt");   char ch;   while(! fin.eof())     {   fin>>ch;   cout     }

Program is to define a class as library: Program is to define a class as library and perform all the function of library management by using classes and object class librar

You are setting up an information system for a DVD Rental Company called Box office. The new system need to hold information about customers and DVDs rentals, payments and fines. C

Program for Hangman Problem   #include   #include   #include   #include   #include   static void playGame();   static void printMistakes(int n);   st

Access privileges 1. If the designer of the base class needs no one, not even a derived class to access a member, then that member should be made private. 2. If the designer

How to write a function template A function template should be written at the beginning of the program in the global area, or you may place it into a header file. All function

Purpose For this assignment you will need to create either a function list or a record series for a CRCRS. Instructions Note: Complete only one of the two assignment op

please provide me the assignment help. What is the difference between a copy constructor and an overloaded assignment operator?

This program requires the use of a windows box, no console applications are allowed. Prepare for Christmas now.  Each year, Reindeer Gift Emporium publishes a Christmas price list