Answer to Question #191863 in C++ for VASANTH V

Question #191863

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-11T10:00:07-0400
#include <iostream>

int sum(int a, int b)
{
    return a + b;
}

float sum(float a, float b)
{
    return a + b;
}

int main()
{
    std::cout << "Sum of ints: "   << sum(1, 2)       << "\n";
    std::cout << "Sum of floats: " << sum(1.0f, 2.0f) << "\n";
    
    return 0;    
}

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