Input two numbers find the sum, use FUNCTION OVERLOADING to calculate sum of two integers, floats
#include<iostream.h>
void main()
{
int a,b,sum(int,int);
float c,d,sum(float,float);
cout<<"enter two no. a & b";
cin>>a>>b;
cout<<"enter two no c & d";
cin>>c>>d;
cout<<"a + b="<<sum(a,b);
cout<<"c + d="<<sum(c,d);
}
int sum(int a,int b)
{
return(a+b);
}
float sum(float c,float d)
{
return(c+d);
}
No comments:
Post a Comment