Monday, April 29, 2013

Function Overloading in C++ Example Problem 1

No comments

  Source Code

           #include "iostream"
using namespace std;
int sum(int,int);
float sum(float,float);
int main()
{
int iNumber1,iNumber2;
float fNumber1,fNumber2;
cout<<"\nEnter Two Integer Number ::";
cin>>iNumber1>>iNumber2;
cin>>fNumber1>>fNumber2;
sum(iNumber1,iNumber2);
sum(fNumber1,fNumber2);
return 0;
}

int sum(int a,int b)
{
cout<<"\nSum is "<<(a+b);
}
float sum(float a, float b)
{
cout<<"\nSum is "<<(a+b)<<endl;
}

0 comments:

Post a 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