โ Back to Functions
Question 409
Function Overloading: Add
Function Overloading: Add
Write two overloaded functions both namedadd: one taking twoints and returning theirintsum, and one taking twodoubles and returning theirdoublesum. Calladd(2, 3)and print the result, then calladd(2.5, 1.5)and print that result with exactly 2 decimal places. The output must be exactly: 5 4.00 The compiler picks the rightaddbased on the argument types.
Expected Output:
5 4.00
Topics:
Functions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.