Count Reads Until Failure
easyQuestion 654The 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, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
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.