Write Then Read Back
easyQuestion 603The 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, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
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.