Reference vs Pointer on the Same Counter
easyQuestion 673A reference ref and a pointer ptr are already declared and both refer to the same count. The program reads one integer from input. Then:
1. add 5 to count using the reference ref
2. multiply count by 2 using the pointer ptr
For the input: 10
the expected output is exactly what is shown in Expected Output.
With an input of -3 the output must be After reference: 2 and After pointer: 4.
Expected output
After reference: 15 After pointer: 30
= newline. The output ends with a newline, so print one after the last line.
Hints2 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.