← Back to Streams
Question 592
Skip the Header Line
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 functionint sumAfterHeader(const string& filename)that returns the sum of all the numbers after the header. The header may contain spaces, for exampledaily 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
Sign in to use hintsTopics:
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.