Shouldn't continue in my else statement return me to the top do...while loop and print the following again?
#include <iostream>
#include <string>
using namespace std;
int main()
{
double withdraw, deposit, balance, newBalance, amount;
char ans;
string choice;
balance = 1000;
cout << "Welcome to Whatever ATM!" << endl;
do
{
cout << "\nWhat would you like to do from the following?\n"
<< "\nWithdraw from account\n"
<< "Deposit money into account\n"
<< "Balance inquiry\n"
<< "Quit\n"
<< "\nPlease select now" << endl;
cin >> choice;
ans = choice[0];
newBalance = balance;
if ((ans == 'w') || (ans == 'W'))
{
cout << "\nWhat amount would you like to withdraw?" << endl;
cin >> amount;
while (amount > balance)
{
cout << "Sorry, you have insufficient funds.\n"
<< "Please try again: ";
cin >> amount;
}
if (amount <= balance)
{
balance = balance - amount;
newBalance = balance;
cout << "Thank you, your new balance is: " << newBalance << endl;
}
}
else if ((ans == 'd') || (ans == 'D'))
{
cout << "\nWhat amount would you like to deposit?" << endl;
cin >> amount;
balance = balance + amount;
newBalance = balance;
cout << "Thank you, your new balance is: " << newBalance <<endl;
}
else if ((ans == 'b') || (ans == 'B'))
cout << "Your balance is: " << balance <<endl;
else if ((ans == 'y') || (ans =='Y'))
{
cout << "\nThank you for banking with Whatever ATM!" << endl;
return 0;
}
else
{
cout << "\nSorry, input not valid, please select again" << endl;
continue;
}
cout << "\nWould you like to make another transaction? (Y/N) ";
cin >> choice;
ans = choice[0];
}
while ((ans == 'y') || (ans =='Y'));
cout << "\nThank you for banking with Whatever ATM!" << endl;
}