multiply and divide using function overloading

#include<iostream.h>

#include<conio.h>


int operate(int a,int b)


{   return(a*b);


}


float operate(float c,float d)


{   return(c/d);


}


void main()


{clrscr();


int a,b;


float m,n;


cout<<"enter a and b  ";


cin>>a>>b;


cout<<operate(a,b);


cout<<"\n";


cout<<"enter m and n  ";


cin>>m>>n;


cout<<operate(m,n);


getch();


}


OUT PUT


enter a and b  45


47


2115


enter m and n  45


47


0.957447

Comments :

Post a Comment