CJCoding With Joseph
15free / daySign inCreate account

Count Reads Until Failure

The program below writes 5 10 15 into numbers.txt and opens it for reading with an fstream. Complete the loop so that it keeps reading integers into n with >> and increments count for every successful read. Then print Read N numbers, where N is the count, followed by a newline.

The program must print exactly the output shown in Expected Output.

Expected Output:

Read 3 numbers

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

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