← Back to Pointers
Question 703
Own One Score with make_unique
Own One Score with make_unique
Read one integer score from standard input. Hand it to aunique_ptr<int>built withmake_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 input42the program prints exactly the output shown in Expected Output. Print only the value the pointer points at, never the pointer itself. Do not writedeleteand do not use a rawnew. Include<memory>.
Expected Output:
Score: 42 Bonus: 52
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Pointers
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.