#include <iostream.h>
int num1,num2;
int acc=1000;
char atm;
char keepon='y'||'Y';
;
void main ()

{

while (keepon=='y'||'Y')
{
cout <<"1. Make a deposit (Press D\n"
<<"2. Widthraw money (Press W)\n"
<<"3. See account info (Press A)\n"
<<"4. Exit Program (Press E)"<<endl;
cin >> atm;

switch (atm)
{
case 'D':
cout <<"Enter amount you want to despoit" <<endl;
cin >> num1;
cout <<"You have a total of " <<num1+acc <<" in your account"<<endl;
cout << "To continue enter Y" <<endl;
cin >> keepon;
break;
case 'W':
cout <<"Enter amount you want to widthraw" <<endl;
cin >> num1;
cout <<"You have a total of " <<acc-num1 <<" in your account"<<endl;
cout << "To continue enter Y" <<endl;
cin >> keepon;
break;
case 'A':
cout <<"Your Account info" <<endl;
cout << "To continue enter Y" <<endl;
cin >> keepon;
break;
case 'E':
cout <<"Goodbye. Have a nice day!" <<endl;
break;
default:
cout <<"\nInvalid operation";
break;
}
}
}
ok this is what i wrote. what i am trouble is that how do I get the balance to roll over?
Like after I press D and deposit $200 I have a total balance of $1200 (everyone start with $1000 balance). then I ask if you want to continue. press y for yes, and bring to the main menu, next I press W for widthraw. but when I widthraw like $500. it widthdraw from the balance of $1000 not my prevous balance, which is $1200. anyone could help me with this?