Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

c++ program to add 2 complex number using operator
overloading technique

Answer Posted / a.bharathi raja

#include<iostream.h>
#include<conio.h>
class complex
{
int r;
int i;
public:
complex()
{ }
complex(int a,int b)
{
r=a;i=b;
}
friend complex operator+(complex,complex);
friend show(complex);
complex operator+(complex c1,complex c2)
{
complex c3;
c3.r=c1.r+c2.r;
c3.i=c1.i+c2.i;
return(c3);
}
show(complex c)
{
cout<<c.r<<"i+"<<c.i<<endl;
}
void main()
{
complex a,b,c;
clrscr();
a.complex(3,6);
b.complex(4,7);
c=a+b;
show(a);
show(b);
show(c);
getch()
}

Is This Answer Correct ?    24 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

plz send me bhel paper....

2200


used of viscocity in petrolium

2554


Equivalent resistance of 100 homs and 200 homs resistors connected in parallel is

1766


how to prepare for bcil bitp

2233


WHO IS INVITED WIRELESS FIDELITY TECHNOLOGY

2253


Can some1 please mail me the question papers of iiit hyderabad...my mail id is cenablogspot@gmail.com

2557


Sir Pl Provide the diploma nautical science sample paper

2494


types of highways

1483


how to works epbx? how to configuration the epbx?

1953


in vfd why we did not give directac ac supply?

2552


c program to compare the initial portions of the two strings and return the matched portion if matches, otherwise return the empty string.

2199


What is the number which when divided by 12,15 and 24 gives remainder 5?

1522


could u send me the model papers for drug inspector exam at imrupinder@gmail.com

2267


If Q is the point of ABCD rectangle where QA=3CM,QB=4CM,and QC=5cm then find the length of QD ?

2922


is vertical heat exchanger has better heat transfer coefficient than horizontal heat exchanger?

1495