← From C to C++: What's New

Overload describe

medium

Complete both overloads of describe – one for int, one for double – each printing its argument with a different label and (for the double version) a fixed 2-decimal-place format.

main calls describe twice, once with an int argument and once with a double one, and never says which version it means – the compiler figures that out from each argument’s type, at compile time, the same way the lesson’s add example did. Notice std::setprecision(2) only needs to be sent to cout once, inside the double overload – it stays in effect for that stream from then on.

Your solution

"Run" uses the sample stdin ("7 3.5"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution