CJCoding With Joseph
15free / daySign inCreate account

Sum to a Stream

Write 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 — 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.