Search This Blog

Saturday, 10 November 2012

Write a c++ program that accept and display complex numbers

Data members
Real part
Imaginary part
Member Functions
  getComplexValues(int real,int imaginary)
  PrintComplexumber()

Programs
#include<iostream.h>
#inclue<conio.h>
class complex
{
private:
int real;
int imaginary;
public:
void getComplexValues(int r,int i)
{
real=r;
imaginary=i;
}
void printComplexNumber()
{
cout<<"The given Complex Number is"<<real<<"+i"<<imaginary<<"\n";
}
};
void main()
{
Complex C;
clrscr();
C.getComplexValues(3,5);
C.printComplexNumber();
getch();
}

Output:
The Given Complex Number is 3+i5


2 comments:

  1. Thank you so much for sharing.
    Have a look on custom software development company,if you want any software solutions.we bring to you the BEST solutions at nominal rates.

    ReplyDelete