Sum to a Stream
easyQuestion 623Write a function void printSum(ostream& out, int a, int b) that writes the equation a + b = sum to out, followed by a newline. There is one space on each side of the + and of the =. Write to out, not to cout.
Output of printSum(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, 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.