Answer to Question #191855 in C++ for Gokul. P

Question #191855

Implement a C++ program to overload the function named as sum, to perform sum of two integer and perform sum of float two number respectively.


1
Expert's answer
2021-05-11T12:22:08-0400
#include<iostream>
using namespace std;
int sum(int a,int b)
{
    int sum;
    sum=a+b;
    return sum;
}
float sum(float a,float b)
{
    float sum;
    sum=a+b;
    return sum;
}
int main()
{
    int a,b;
    float c,d;
    cout<<"Enter two integer numbers ";
    cin>>a>>b;
    cout<<"\nSum of two integer numbers = "<<sum(a,b);
    cout<<"\nEnter two float values ";
    cin>>c>>d;
    cout<<"\nSum of two float values = "<<sum(c,d);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment