Swap Two Inventory Counts by Reference
easyQuestion 680Write 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, so 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.