← Back to Streams
Question 623
Sum to a Stream
Sum to a Stream
Write a functionvoid printSum(ostream& out, int a, int b)that writes the equationa + b = sumtoout, followed by a newline. There is one space on each side of the+and of the=. Write toout, not tocout. Output ofprintSum(cout, 3, 4)(see Expected Output). Do NOT write a main function.
Expected Output:
3 + 4 = 7 10 + 20 = 30 0 + 0 = 0
= 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.