-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatm_v2.cpp
246 lines (218 loc) · 3.88 KB
/
atm_v2.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
using namespace std;
float bal=2000.0;
int pin=2468;
class atm
{
private:
int choice,pin_ver,votp,gpin1,gpinf,step,ced,back;
float camt,with_amt,dep_amt;
public:
// int choicef();
float with_money();
float dep_money();
int gpin();
int verf(int pinv);
int balc();
};
atm p4;
//ATM PIN VERIFICATION
int atm::verf(int pinv)
{
if(pin==pinv)
{
return 1;
}
else
{
return 0;
}
}
//green pin genration
int atm::gpin() {
//atm p2;
step=0;
loc2:
if(step==1)
{
step=1;
}
else
system("CLS");
cout << "Enter your OTP: ";
cin >> votp;
// ####otp verification###
system("CLS");
cout << "Enter your new green PIN: ";
cin >> gpin1;
system("CLS");
cout << "Re-Enter your green PIN: ";
cin >> gpinf;
if (gpin1 == gpinf) {
pin = gpinf;
return 0;
} else {
system("CLS");
cout << ">>>Entered PINs do not match.<<<<" << endl;
step=1;
goto loc2;
}
cout<<"press 1 to go back"<<endl;
cin>>back;
if(back==1)
{
// p2.choicef();
}
else
{
// p2.choicef();
}
}
int atm::balc()
{ system("CLS");
atm p2;
loc4: cout<<"Enter you PIN"<<endl;
cin>>pin_ver;
switch (p2.verf(pin_ver))
{
case 1:
system("CLS");
cout<<"Your Current Balence: "<<bal<<endl;
break;
default:
system("CLS");
cout<<"Incorrect PIN Try Again!"<<endl;
goto loc4;
break;
}
cout<<"press 1 to go back"<<endl;
cin>>back;
if(back==1)
{
// p2.choicef();
}
else
{
//p2.choicef();
}
return 0;
}
// withdraw money
float atm::with_money()
{ atm p2;
system("CLS");
cout<<"enter amount to withdarw"<<endl;
cin>>with_amt;
system("CLS");
loc3: cout<<"Enter you PIN"<<endl;
cin>>pin_ver;
switch (p2.verf(pin_ver))
{
case 1:
camt=bal-with_amt;
system("CLS");
cout<<"cash withdrawed successfully"<<endl;
break;
default:
system("CLS");
cout<<"Incorrect PIN Try Again!"<<endl;
goto loc3;
break;
}
cout<<"press 1 to go back"<<endl;
cin>>back;
if(back==1)
{
// p2.choicef();
}
else
{
// p2.choicef();
}
return camt;
}
//deposit money
float atm::dep_money()
{
atm p2;
system("CLS");
cout<<"enter amount to deposit"<<endl;
cin>>dep_amt;
system("CLS");
loc4: cout<<"Enter you PIN"<<endl;
cin>>pin_ver;
switch (p2.verf(pin_ver))
{
case 1:
camt=bal+dep_amt;
system("CLS");
cout<<"cash deposition successfull"<<endl;
break;
default:
system("CLS");
cout<<"Incorrect PIN Try Again!"<<endl;
goto loc4;
break;
}
cout<<"press 1 to go back"<<endl;
cin>>back;
if(back==1)
{
// p2.choicef();
}
else
{
//p2.choicef();
}
return camt;
}
/*atm::~atm()
{
} */
int main()
{ atm p1;
//atm syss;
int choice;
system("CLS");
// atm p1;
// p1.choicef();
while (1)
{
loc1: system("CLS");
cout<<" >>>select<<< "<<endl;
cout<<"1. Genrate Green PIN"<<endl;
cout<<"2. check balence"<<endl;
cout<<"3. withdraw money"<<endl;
cout<<"4. deposit money"<<endl;
cin>>choice;
switch (choice)
{
case 1:
p1.gpin();
break;
case 2:
p1.balc();
break;
case 3:
bal=p1.with_money();
break;
case 4:
bal=p1.dep_money();
break;
default:
cout<<"invalid input Try again";
goto loc1;
break;
} }
return 0;
}
/*
By: Karthik Prabhu
github: https://github.com/karthikprabhu10
Ver : 2.10
update : 14 Oct 2023
-K4X
*/