c++ - Does not show the data entry form as I want -


i'm doing simple banking system, in system doing account creation method create new account.
when client enter, create new account, must enter personal data.
know problem stupid , simple @ same time.

the problem when client entering information, supposed show data follows.

  • your first name: (and waits client input)
  • your last name: ( andwaits client input)
  • your age: ( , waits client input)
  • your address: (and waits client input)

    natural occurs above, happens not that.

that happens following.

your first name: (doesn't waits client inputs continue ) last name: (and waits client input).
your age: (waits client input) .
your address: (doesn't waits client inputs continue ) press key continue . . .

what happens same previous figure.

i did not put codes, added important codes only.

// struct  store client information. struct bc_detail{     char cfistname[15];     char clastname[15];     unsigned short usage;     char caddress[64]; };   // create  account class account_create { private:     int naccountnumber; // account number     time_t ncreationdate;  // date of join     int nbalance;        // amount of money     bc_detail client; // instance of bc_detail store client info  public:     void createaccount(); // create 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; } 

the problem you're mixing calls getline() ">>":

c++ getline() isn't waiting input console when called multiple times

suggestions:

  • substitute ">>" cin.getline()

  • at same time, substitute "std::string" "char name[15]".

  • also consider substituting class "struct bc_detail".


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -