CJCoding With Joseph
15free / daySign inCreate account

Return the Stream for Chaining

Write 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 — print one after the last line.

Hints2 available
Topics:
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.