CIN和getline跳过输入
cin
istringstream
void createNewCustomer () { string name, address; cout << "Creating a new customer..." << endl; cout << "Enter the customer's name: "; getline(cin, name); cout << "Enter the customer's address: "; getline(cin, address); Customer c(name, address, 0); CustomerDB::addCustomer(c); cout << endl;}
cin.ignore()
, cin.get()
cin.clear()
mainMenu()
void mainMenu () { char choice; do { system("cls"); mainMenuDisplay(); cin >> choice; system("cls"); switch (choice) { case '1': customerMenu(); break; case '2': dvdMenu(); break; case '3': receiptMenu(); break; case '4': outro(); break; default: cout << '\a'; } cin.ignore(); cin.get(); } while (choice != '4');}
customerMenu()
void customerMenu () { char choice; do { system("cls"); manageCustomerMenu(); cin >> choice; system("cls"); switch (choice) { case '1': createNewCustomer(); break; case '2': deleteCustomer(); break; case '3': updateCustomerStatus(); break; case '4': viewCustomersList(); break; case '5': mainMenu(); break; default: cout << '\a'; } cin.ignore(); cin.get(); } while (choice != '5');}
汪汪一只猫
慕田峪4524236
慕沐林林