Recall the several modes which are supported for working with files:
Read (the default one)
Read + Write
Create (error if present)
There are different files present on the computer. You are asked to add some lines to them.
The input contains 2 lines. The first line is the name of the file. The second one is the content we would like to add to that file.
The program needs to first add the specified line to the file and then print the whole content of the file.
Input doc.txt This is the second line doc.txt (initial content) This is the first line Output This is the first line This is the second line doc.txt (resulting content) This is the first line This is the second line