Monday, April 29, 2013

Function Overloading in C++ Example Problem 2

1 comment

SOURCE CODE

#include "iostream"
using namespace std;
int sum(int,int);
float sum(double,double);
int main()
{
sum(4,4);
sum(4.0,4.0);
return 0;
}

int sum(int a,int b)
{
cout<<"\n int Sum() is "<<(a+b)<<endl;
return 0;
}
float sum(double a, double b)
{
cout<<"\n float Sum is "<<(a+b)<<endl;
return 0;
}

1 comment:

Entries RSS Comments RSS

Sample Text

Pages


Copyright © Lovely Codes
Powered by Blogger
Distributed By Free Blogger Templates | Design by N.Design Studio
Blogger Theme by Lasantha - PremiumBloggerTemplates.com