I'm doing a simple banking system, in this system I doing account creation
method to create new account.
When the client enter, to create new account, he must enter his personal data.
I know the problem is stupid and simple at the same time.
The problem is when a client entering his information, Supposed to show the data as follows.
Your First name: (and waits for client input)
Your last name: ( andwaits for client input)
Your age: ( and waits for client input)
Your address: (and waits for client input)
Natural that occurs above, but what happens not like that.
That happens is the following.
Your First name: (doesn't waits client inputs then continue ) Your last name: (and waits for client input).
Your age: (waits for client input) .
Your address: (doesn't waits client inputs then continue ) press any key to continue . . .
What happens is exactly the same as the previous figure.
I did not put all the codes, but I added the important codes only.
// this struct to store the client information.
struct bc_Detail{
char cFistName[15];
char cLastName[15];
unsigned short usAge;
char cAddress[64];
};
// create an account
class Account_Create {
private:
int nAccountNumber; // account number
time_t nCreationDate; // date of join
int nBalance; // The amount of money
bc_Detail client; // instance of bc_Detail to store client info
public:
void createAccount(); // to create the account
};
// contents of create account method
void Account_Create::createAccount(){
std::cout << "Your First name: ";
std::cin.getline(client.cFistName, 15);
std::cout << "Your last name: ";
std::cin.getline(client.cLastName, 15);
std::cout << "Your age: ";
std::cin >> client.usAge;
std::cout << "Your address: ";
std::cin.getline(client.cAddress, 64);
}
int main(){
Account_Create create;
create.createAccount();
return 0;
}