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
22. A solution of 1% (w/v) starch at pH 6.7 is digested by 15 μg of β‐amylase (mol wt 152,000). The rate of maltose (mol wt = 342) had a maximal initial velocity of 8.5 mg formed per min. The turnover number is
I have cleared sbi clerk and have interview in 26/04/2010.But I am M.Ed & B.Ed,i want to u know my answed about not chose the teaching post
Equivalent resistance of 100 homs and 200 homs resistors connected in parallel is
plz send me bhel paper....
please send me NTPC previous papers on my email ID 18amarjeet.civil@gmail.com or mr.yadav143@gmail.com
what is the difference between interface and abstract class
.students decide to gift principal 4200 rupees. if teachers give 50% more than the students and an external person gives 3 times to that of teachers.how much do teachers give.
what is monetary policy
The horse has played a little known but very important role in the field of medicine. Horses were injected with toxins of diseases until their blood built up immunities. Then a serum was made from their blood.Serums to fight with diphtheria and tetanus were developed this way. It can be inferred from the passage, that horses were (A) given immunity to diseases (B) generally quite immune to diseases (C) given medicines to fight toxins (D) given diphtheria and tetanus serums
used of viscocity in petrolium
difference between pvc and gi pipes?
the servents of india society was founded by ?
Can some1 please mail me the question papers of iiit hyderabad...my mail id is cenablogspot@gmail.com
Respected sir/madam, My self R SANKAR. I am final year BE civil engineering student (2014-2018). i have shortlisted for isro exam 2018.last university exam (7th sem) result was declared i have scored 6.98CGPA. but they not provide last result mark sheet still now 1. What are the documents bring to isro exam venue? 2. either bring bonafide certificate from college instead of mark sheets?
types of highways