CJCoding With Joseph
15free / daySign inCreate account

A file holds one record per line in the form name,score with no spaces around the comma:

Bob,90 Amy,85

Write a function void printScores(const string& filename) that prints one line per record in the form <name> scored <score>, in file order, each ending with a newline (see Expected Output).

The score is printed exactly as it appears in the file.

Do NOT write a main function.

Expected output

Bob scored 90
Amy scored 85
Li scored 7
Mo scored 42
Na scored 99

= newline. The output ends with a newline, so 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.