Read and write files in C++. Not allowing user input

Hi. I was trying to figure out how to read and write files in C++. To understand it better I wrote this code on "codepile.com": https://www.codepile.net/pile/WDPkzrep. What it does is it allows a user to create their own text file then write information in it. Lastly, the contents of the file will be read.

The problem is that it will allow a user create a text file but will not allow them to type anything into the file. Also, because the program stops after the line that says "please enter text:" (keep in mind that the program will not allow user to type anything at this point), I does not run the last part of the code which is to read what was in the file.

How would I fix this? Should I break the program up into functions and call the functions? Thank you.