CJCoding With Joseph
15free / daySign inCreate account

Skip the Header Line

The first line of the file is a text header that must be skipped; every line after it holds integers separated by spaces or newlines:

scores
20 25 30

Write a function int sumAfterHeader(const string& filename) that returns the sum of all the numbers after the header. The header may contain spaces, for example daily totals.

The test prints the returned sum on its own line, for example (see Expected Output).

Do NOT write a main function.

Expected Output:

75
14

= newline. The output ends with a newline — print one after the last line.

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