I have the following program in C++:
There are two problems with this program. First of all, if the user makes use of spaces in the text, then the data after the first space is NOT saved. How can I solve this problem?
Secondly, I want to include a line break between the text appended in one session and another in the text file. How can I instruct the program to do so? Thanks 🙂
You can use
getlineto get lines of user input at a time. As for the line break between sessions can’t you just write a new line to the file after the user is done inputting text. That way the next time you open the file you will start after the line break.