-
Notifications
You must be signed in to change notification settings - Fork 20
/
atm.cc
47 lines (35 loc) · 1.22 KB
/
atm.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* atm.cc */
#include "atm.h"
int main()
{
cout<<"ATM SIMULATION"<<endl;
authentication authen;
authen.authenticate();
return 0;
}
void authentication::authenticate()
{
pin=9501;
cout<<"Enter your card PIN : ";
cin>>pin;
if(pin==9501){myATM opt; opt.options();}else
{
cout<<"Wrong PIN. (1 chance) !"<<endl;cout<<"Enter your card PIN : ";cin>>pin;
if(pin==9501){myATM opt; opt.options();}else{cout<<"Wrong PIN. (Last chance) !"<<endl;cout<<"Enter your card PIN : ";cin>>pin;
if(pin==9501){myATM opt; opt.options();}else{cout<<"You have exeeded the attempt limit. Goodbye"<<endl;}
}
}
}
void myATM::options()
{
myATM ATMOPT; ATMOPT.atm_stuff();
int opt;
cout<<"Please select a transaction : ";cin>>opt;
if(opt==1){cout<<"Deposit transaction"<<endl;myATM depost; depost.acc_deposit();}else if(opt==2){cout<<"Balance inquiry"<<endl;myATM bal; bal.acc_balance();}else if(opt==3){cout<<"Withdrawal transaction"<<endl;myATM wthdrw; wthdrw.withdrawal();}
else{cout<<"Invalid choice ! Try again"<<endl; myATM opt; opt.options();}
}
void myATM::atm_stuff()
{
cout<<"ATM OPTIONS"<<endl;
cout<<"1: CASH DEPOSIT"<<endl; cout<<"2: BALANCE INQUIRY"<<endl; cout<<"3: CASH WITHDRAWAL"<<endl;
}