CJCoding With Joseph
15free / daySign inCreate account

Write Then Read Back

The program opens the file words.txt with an ofstream called out, closes it, then reopens the same file with an ifstream and prints every line it finds. The reading part is already written.

Fill in the two commented lines so the file contains exactly two lines: alpha on the first line and beta on the second (each followed by a newline). Expected output the output shown in Expected Output.

Expected Output:

alpha
beta

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

Hints2 available
Topics:
Streamsofstream
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.