CJCoding With Joseph
15free / daySign inCreate account

Own One Score with make_unique

Read one integer score from standard input. Hand it to a unique_ptr<int> built with make_unique, print the value through the pointer, then add 10 to the value through the pointer and print it again. The number itself must live on the heap.

For the input 42 the program prints exactly the output shown in Expected Output.

Print only the value the pointer points at, never the pointer itself. Do not write delete and do not use a raw new. Include <memory>.

Expected Output:

Score: 42
Bonus: 52

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

Hints4 available
Topics:
Pointers
📥 Auto-Input:
42\n
This input is automatically fed to your program's stdin
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.