Program of FUNCTION OVERLOADING

/*Program of FUNCTION OVERLOADING*/ #include #include int add(int,int,int); // function declaration float add(float,float); // function declaration int add(int q, int w, int e) // function definition { return (q+w+e); } float add(float a, float s) // function defintion { return (a*s); } int main() { int q,w,e; float a,s; coutq>>w>>e; int p=add(q,w,e); // function calling through parameters cout

Program of BINARY OPERATOR OVERLOADING using member function

/*Program of  BINARY OPERATOR OVERLOADING using member  function*/ #include<conio.h> #include<iostream.h> class A { int a,b; public: void getdata(int p,int q) { a=p; b=q; } void display() { cout<<“\na=”<<a<<“\nb=”<<b; } A operator+(A a1) { a1.a=a1.a+a; a1.b=a1.b+b; return a1; } }; int main() { A a1,a2,a3; int f,g,h,i; cout<<“\nEnter 2 numbers\n”; cin>>f>>g; a1.getdata(f,g); a1.display(); cout<<“\nEnter 2 numbers\n”; cin>>h>>i; a2.getdata(h,i); a3.display(); a3=a2+a1; getch(); return 0; } OUTPUT    : Enter any number 5 Enter another number 7 Addition of these numbers = 12

Program for the addition of 3 complex numbers using FRIEND function

/*Program for the addition of 3 complex numbers using FRIEND function*/ #include<iostream.h> #include<conio.h> class complex { int real,imag; public: complex() { } complex(int f,int g) { real=f; imag=g; } void display() { cout<<real<<“+i”<<imag; } friend complex sum (complex,complex,complex); }; complex sum(complex q,complex w,complex e) { complex r; r.real=q.real+w.real+e.real; r.imag=q.imag+w.imag+e.imag; return r; } int main() { int z,x,c,v,y,u; cout<<“\n\nenter the real and imaginary part of 1st complex number\n”; cin>>y>>u; complex p(y,u); cout<<“1st complex number       “; p.display(); cout<<“\n\nenter the real and imaginary ……