It isn't working because you have not obeyed my advice. The user can hit enter a zillion times and it won't make any difference as long as you are using cin >> newfile;.
Also, notice how most of the lines you have written are exactly the same. Put all the stuff that writes to file by itself, once, after the file is opened using your if...else statement.
Reputation Points: 1140
Solved Threads: 229
Postaholic
Offline 2,039 posts
since Oct 2007