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

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();

       }

Posted Date: 10/18/2012 6:36:53 AM | Location : United States







Related Discussions:- Define a complex number in c program, Assignment Help, Ask Question on Define a complex number in c program, Get Answer, Expert's Help, Define a complex number in c program Discussions

Write discussion on Define a complex number in c program
Your posts are moderated
Related Questions
To complete this assignment, edit the following constructors and methods: 1. public MaxPQ(Key[] keys) - change the following loop for (int k = N/2; k >= 1; k--) sink(k);

I need whatsapp software in my website Project Description: i need whatsapp software in my website same this whatsapp if anyone can make to me this in my website Skills

In this project, you will write a software for the Registrar's office of a university called YouOIT to maintain information about students and courses at the university. The reg

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw

railway reservation programming

All languages are divided into six sections: - variables, I/O maths, conditional expressions, arrays, functions, subroutines and file handlers. Learning a software language is simi

example of program to ad two numbers

#padovan string   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanString {

Illustrate the Function Definition? The C code that explains what a function does is called the function definition. A function definition has the following form Type fun

Implement (a part of) electronic election Scenario where following political parties are participating in election: PPP, PML and PTI.  Create a class PollingStation where it stor