这是我分配的一个较大程序的一部分,但由于某种原因,每次我运行该程序时,无论输入什么,它都会跳转到默认值
void menuChoice::selection() {
int userSelection;
cout << "Hello to our store! " << endl;
cout << "press (1) to login" << endl;
cout << "press (2) to Register" << endl;
cin >> userSelection;
switch (userSelection) {
case '1': {
Register r;
r.Registion();
break;
}
case '2': {
Login u;
u.userLogin();
break;
}
default:
cout << "Invalid input" << endl;
}
}