Hi guys, i am working on a bank program for school but i am running in to a small problem. when the program starts up its displays a menu such as:
item 1
item 2
item 3
And say if you click item 2, it will do waht ever it is supposed to do but when its finished, it wont return back to the menu. (it just closes)
How can i make it so that after i have made my choice, say i withdraw 500$, make it come back to the beginning menu where i can make other choices or withdraw money again etc. I have jsut started learning c++ in school so i am only about 4-5 weeks in.
//BANK ATM PROGRAM.
#include <iostream>
using namespace std;
int main ()
{
double pass = 0;
double choice;
int account;
int with;
int bank1 = 500;
int bank2 = 500;
int amount;
int deposit;
cout<<"Please enter you PIN code"<<endl;
cin>>pass;
if (pass == 5555)
cout<<"PIN VALIDATED...."<<endl;
do
{
if (pass != 5555)
{
cout<<"Please enter you PIN Again code"<<endl;
cin>>pass;
}
}while( pass != 5555);
system("cls");
while(pass == 5555)
{
cout<<"PLEASE PICK ONE OF THE BELOW OPTIONS"<<endl;
cout<<"1)DRAW FUNDS"<<endl;
cout<<"2)DEPOSIT"<<endl;
cout<<"3)TRANSFER"<<endl;
cout<<"4)CHECK BALANCE"<<endl;
cout<<"5)CLOSE"<<endl;
cin>>choice;
//WITHDRAW
if (choice == 1)
{
system("cls");
cout<<"WHICH ACCOUNT WOULD YOU LIEK TO WITHDRAW FROM"<<endl;
cout<<"ACCOUNT ONE"<<endl;
cout<<"ACCOUNT TWO"<<endl;
cin>>account;
//account one
if(account == 1)
{
cout<<"HOW MUCH WOULD YOU LIKE TO WITH DRAW FROM ACCOUNT ONE? YOU HAVE "<< bank1 <<endl;
cin>>with;
bank1 = bank1 - with;
cout<<"YOU WITHDREW " <<with<< " AND HAVE "<<bank1<< " LEFT "<<endl;
}
//account two
if(account == 2)
{
cout<<"HOW MUCH WOULD YOU LIKE TO WITH DRAW FROM ACCOUNT TWO? YOU HAVE "<< bank2 <<endl;
cin>>with;
bank2 = bank2 - with;
cout<<"YOU WITHDREW " <<with<< " AND HAVE "<<bank2<< " LEFT "<<endl;
}
}
system("pause");
return(0);
}
}
see where it says
cout<<"YOU WITHDREW " <<with<< " AND HAVE "<<bank2<< " LEFT "<<endl;
how can i make it go back to
cout<<"1)DRAW FUNDS"<<endl;
cout<<"2)DEPOSIT"<<endl;
cout<<"3)TRANSFER"<<endl;
cout<<"4)CHECK BALANCE"<<endl;
cout<<"5)CLOSE"<<endl;
cin>>choice;
again to pick other choices. thanks, help would be appreciated.