Return the Stream for Chaining
easyQuestion 629Write a function ostream& printPair(ostream& out, int a, int b) that writes (a, b) — an opening parenthesis, the first number, a comma and a space, the second number, a closing parenthesis — to out with NO newline, and then returns out.
Output of printPair(cout, 1, 2) << "!\n"; (see Expected Output).
Do NOT write a main function.
Expected output
(1, 2)! (5, 9) end
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Streamsostream
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.