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

Where php basically used, Why many companies are switching their current bu...

Why many companies are switching their current business language to PHP? Where PHP basically used? PHP is rapidly gaining popularity and numerous companies are switching their

C programming, a c program to find the volume of sphere

a c program to find the volume of sphere

Inbuilt functions in cpp, Inbuilt Functions i).  Functions to manipulate...

Inbuilt Functions i).  Functions to manipulate strings The cstring library defines many functions to perform some manipulation operations with C-styled functions. The followi

Sort wars, Explain each of the algorithms in a way that would be understand...

Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

C with thread , #I have assignment c with unix thread multiplication progr...

#I have assignment c with unix thread multiplication program ..

C program to print r diagonal triangle, C program to print R diagonal trian...

C program to print R diagonal triangle: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];

Pointers, Pointers are just numbers, representing addresses in memory. You ...

Pointers are just numbers, representing addresses in memory. You can add to and subtract from pointers, for instance. It is pretty easy to make mistakes with pointer math, however,

Stack, c++ program to to implement multiple stacks using single array

c++ program to to implement multiple stacks using single array

Write a program to calculate the total resistance, Write a program to calcu...

Write a program to calculate the total resistance of a series or parallel circuit. The maximum number of resistors is two.   We need to decide whether the user wants the to

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