Can someone please assist me, Im having difficulties with this switch statement, instructions are below.
If the user enters 2 to make a withdrawal, the user will be prompted to enter an amount or type
0 (zero) to return to the main menu.
a. If the withdrawal amount is greater than the account balance, the screen will display an
error message stating this and prompts them to enter a smaller amount.
b. If the withdrawal amount can be satisfied, carry out the transaction, display the new balance and return to the main menu.
Code:
case 2: cout << "Please Enter sum you wish to withdraw from account" << endl;
cin >> withdraw;
if ( withdraw > balance){
cout << "Value Exceeds Current balance \n" << endl;
cout << "please enter new amount or type 0 to return to menu" <<endl;
cin >> withdraw;
}
if (input == 0){
return 0;
}
balance = balance - withdraw;{
cout << " You Have Withdrawn" << withdraw << "From your Accout" << endl;
cout << " Balance is now" << balance << endl;
}
break;