CJCoding With Joseph
15free / daySign inCreate account

Swap Two Inventory Counts by Reference

Write the body of void swapCounts(int &shelfA, int &shelfB) so it swaps the two integers it is given.

main is already written: it reads two integers from input (the count on shelf A, then the count on shelf B), calls swapCounts(a, b), and prints them.

For the input:

12 30

the program must print exactly the output shown in Expected Output.

Do not print anything inside swapCounts.

Expected Output:

shelfA=30 shelfB=12

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

Hints4 available
Topics:
Pointers
📥 Auto-Input:
12 30\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.