← Back to Streams
Question 629
Return the Stream for Chaining
Return the Stream for Chaining
Write a functionostream& 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 — tooutwith NO newline, and then returnsout. Output ofprintPair(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
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.