CJCoding With Joseph
15free / daySign inCreate account

tellg After Reading

The program below writes the eleven characters hello world (no newline) into words.txt, then opens it for reading with an fstream. Complete it so that it reads one word from the file with >> and then prints the current read position, cast to long, in the form Position: N followed 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
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.