char ChooseStack() { char choice; while (choice != 'A' || choice != 'B' || choice != 'C') { cout << "Which stack do you want to choose from ('a', 'b', 'c') ? "; cin >> choice; switch (choice) { case 'a': case 'A': choice = 'A'; break; case 'b': case 'B': choice = 'B'; break; case 'c': case 'C': choice = 'C'; break; default: cout << "Invalid choice." << endl; } } return choice; } |
char ChooseStack() { char choice; int n = 0; while (n == 0) { cout << "Which stack do you want to choose from ('a', 'b', 'c') ? "; cin >> choice; switch (choice) { case 'a': case 'A': choice = 'A'; n = 1; break; case 'b': case 'B': choice = 'B'; n = 1; break; case 'c': case 'C': choice = 'C'; n = 1; break; default: cout << "Invalid choice." << endl; } } return choice; } |
|
|