Yung switch pwedeng pamalit sa if-else lalo na kung masyado mahaba/madami yung conditions. Pero pag pinag-karambola mo, mas mahirap unawain. Suggest ko, stick with either switch o if-else.
Pag naayos mo na at na-implement yung suggestion sa taas, pwede mo din i-sama ang while loop (until the user enters the correct option, o he wants to quit altogether)
Code:
// The option to quit is not included. You can add it later.
while (pin != 123) {
std::cout << "Incorrect PIN. Please re-enter: " << std::flush;
std::cin >> pin;
}
// Condition above was satisfied. Now proceed here.
while (trans != 1 || trans || != 2 ...etc) {
std::cout << " Menu " << "\n";
std::cout << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _" << "\n";
std::cout << "[1] Balance Inquiry" << "\n";
std::cout << "[2] Withdrawal" << "\n";
std::cout << "[3] Quit" << "\n";
std::cout << "Select Transaction" << "\n";
std::cin >> trans;
}