Hello, reader. I've been learning c++ like a mother recently and, believe it or not, I've encountered a problem! Or, more of a writers block.
note:You don't have to read all this crap, my question is at the end of this post.
I'm making an account management program to better my skill in programming.
It accepts input from the user for personal information then saves it to a .txt file.
I'll show you the code so you can get a better idea of what I'm talking about:
Right now it's a mess and I haven't got half the features done, but what it's suppose to do is open up, give you the option to "create an account", and then save it.
This is an information database program.
By Jacob Keller
March 12, 2008
using namespace std;
ofstream account_a ("accounts.txt", ios::app);
cout<<"To create an account, type 'new'. ";
cout<<"Enter first name: \n";
cout<<"Enter last name: \n";
cout<<"Enter home phone number: \n";
cout<<"Enter address: \n";
account_a<<"Name: " <<fullname<<". Address: "<<address<<". Phone Number: "<<phonenumber<<".";
cout<<"New account saved to accounts.txt \n";
But, (because of cin.get(); I believe) it closes once you press enter, not giving the user a chance to create an account. The only way I see of resolving this problem is by hitting a key without hitting the enter key.
So is there a way to make the program wait for the user to press a specific key instead of using enter? If so, please tell me.