← Back to Streams
Question 651
tellg After Reading
tellg After Reading
The program below writes the eleven charactershello world(no newline) intowords.txt, then opens it for reading with anfstream. Complete it so that it reads one word from the file with>>and then prints the current read position, cast tolong, in the formPosition: Nfollowed by a newline. The program must print exactly the output shown in Expected Output.
Expected Output:
Position: 5= newline. The output ends with a newline — print one after the last line.
Hints2 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.