CJCoding With Joseph
15free / daySign inCreate account

Declare Variables with decltype

decltype(expression) gives you the TYPE of an expression without writing the type yourself. In main, count is an int and price is a double, and count * price is a double, because an int multiplied by a double becomes a double.

Use decltype instead of a written type to declare three new variables:

- copyCount with the type of count, initialized to count * 2 - halfPrice with the type of price, initialized to price / 2 - total with the type of count * price, initialized to count * price

Then print the three variables in that order, one per line. Before you run it, work out each type and value yourself; decimal results print without trailing zeros.

Expected Output:

14
1.25
17.5

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Templates
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.