I have a problem and require assistance

So I'm trying to make a banking project and I have the user deposit or withdraw, I tried looping it so if they want to continue, they can choose to deposit or withdraw again but it only loops the choice they chose in the beginning, for example if they chose to deposit, and they choose to continue, they don't get asked if they want to deposit or withdraw, it just tells them how much they want to deposit, here's my code.


#include <iostream>
#include <string>
using namespace std;
int main()
{
// Intro
cout<<"Welcome to National Suhaib Bank (NSB)\nPlease enter your username and password!"<<endl<<endl;

// Asks user for username input
cout<<"Username: ";
string username;
cin>>username;

// Asks user for password input
cout<<"Password: ";
string password;
cin>>password;

// Asking for deposit or withdraw
cout<<"\nWelcome to NSB!\n\nWould you like to deposit or withdraw?"<<endl;

string choice;
cin>>choice;

// Deposit and Withdraw
int balance;
balance = 150;

string c1;
c1 = "yes";
while(c1 == "y" || c1 == "Y" || c1 == "yes" || c1 == "Yes")
{
if(choice == "deposit" || choice == "Deposit" || choice == "d" || choice == "D")
{
cout<<"\n\n\n\n\nYour balance is "<<balance<<"BHD"<<endl<<endl<<"How much would you like to deposit?"<<endl;

int dAmount;
cin>>dAmount;
balance = balance + dAmount;
cout<<"\nYour balance after deposit is "<<balance<<"BHD"<<endl<<"Thank you for using NSB!\n\n";
}
else if(choice == "withdraw" || choice == "w" || choice == "Withdraw" || choice == "W")
{
cout<<"\n\n\n\n\nYour balance is "<<balance<<"BHD"<<endl<<endl<<"How much would you like to withdraw?"<<endl;

int wAmount;
cin>>wAmount;
balance = balance - wAmount;
cout<<"\nYour balance after withdraw is "<<balance<<"BHD"<<endl<<"Thank you for using NSB!\n\n";
}
else
{
cout<<"You entered an invalid response, goodbye. \n\n";
}
cout<<"Do you want to continue? (y/n)\n";
cin>>c1;
}
}
The code only asks if the person wants to deposit or withdraw outside of the while loop. That needs to move inside the while loop so the value of choice can change each time through.
Topic archived. No new replies allowed.