-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bank.c
342 lines (310 loc) · 10.4 KB
/
Bank.c
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
/* CMD BANK
Yunus Emre Aydýnlý
22.08.2020 00:11 */
#include<stdio.h>
#include<locale.h>
#include<conio.h>
int language;
int main() {
// setlocale(LC_ALL,"turkish");
int pass, x=10;
printf("\t\t\t\t\t --------------------------------------- \n");
printf("\t\t\t\t\t * Inserting the card... *\n");
printf("\t\t\t\t\t --------------------------------------- \n\n");
sleep(2);
system("CLS");
printf("\t\t\t\t\t --------------------------------------- \n");
printf("\t\t\t\t\t * Inserting the card... *\n");
printf("\t\t\t\t\t * The card is approved, please wait. *\n");
printf("\t\t\t\t\t --------------------------------------- \n\n");
sleep(2);
system("CLS");
printf("\t\t\t\t\t ---------------------------------------- \n");
printf("\t\t\t\t\t * WELCOME TO CMD BANK! *\n");
printf("\t\t\t\t\t ---------------------------------------- \n\n");
printf("\t\t\t\t\t Please choose your language! \n");
printf("\t\t\t\t\t (English = 1 / Turkish = 2 / EXIT: 3): ");
scanf("%d", &language);
if (language == 1) {
printf("\n\t\t\t\t\tApplication language is English. Please wait...");
} else if (language == 2) {
printf("\n\t\t\t\t\tUygulama dili Turkce yapiliyor. Lutfen Bekleyiniz...");
}
else if (language == 3) {
return 0;
}
else {
system("CLS");
//printf("\n\n\n\n\n\n\n\n\n\n\n\n"); //bunu açarsan hata mesajý ortalanýr.
printf("\t\t\t\t ---------------------------------------------------------\n");
printf("\t\t\t\t * Error! Please enter the numbers requested from you. *\n");
printf("\t\t\t\t ---------------------------------------------------------");
sleep(1);
system("CLS");
return main();
}
sleep(1);
system("CLS");
while (x != 0) {
if(language == 1 ) {
system("CLS");
printf("\t\t\t\t\t ---------------------------------------- \n");
printf("\t\t\t\t\t * WELCOME TO CMD BANK! *\n");
printf("\t\t\t\t\t ---------------------------------------- \n\n");
printf("\t\t\t\t\t\a Enter your password: ");
}
else {
system("CLS");
printf("\t\t\t\t\t ---------------------------------------- \n");
printf("\t\t\t\t\t * CMD BANKASINA HOSGELDINIZ! *\n");
printf("\t\t\t\t\t ---------------------------------------- \n\n");
printf("\t\t\t\t\t\a Parolanizi giriniz: ");
}
scanf("%d", &pass);
if (pass == 123) {
if(language == 1 ) {
printf("\n\t\t\t\t\t Logging in...\n");
}
else {
printf("\n\t\t\t\t\t Giris yapiliyor...\n");
}
x=0;
if(language == 1) {
printf("\t\t\t\t\t Please wait...");
sleep(1);
system("CLS");
}
else {
printf("\t\t\t\t\t Lutfen Bekleyiniz...");
sleep(1);
system("CLS");
}
}
else {
if(language == 1) {
printf("\n\t\t\t\t\t Wrong password, try another password.");
sleep(1);
system("CLS");
}
else {
printf("\n\t\t\t\t\t Yanlis sifre, baska bir sifre deneyin.");
sleep(1);
system("CLS");
}
}
}
system("CLS");
calistir();
return 0;
}
void calistir() {
int islem;
int bakiye = 1000;
int tutar;
if(language == 1) {
printf("\t\t\t\t\t ----------------------------------------\n");
printf("\t\t\t\t\t * WELCOME TO CMD BANK! *\n");
printf("\t\t\t\t\t ----------------------------------------\n\n");
}
else {
printf("\t\t\t\t\t ----------------------------------------\n");
printf("\t\t\t\t\t * CMD BANKASINA HOSGELDINIZ! *\n");
printf("\t\t\t\t\t ----------------------------------------\n");
//printf("\t\t\t\t\t |\t\t\t\t\t |\n");
}
if(language == 1) {
printf("\n\t\t\t\t\t\t\t TRANSACTIONS\n\n");
printf("\t\t\t\t\t -------------------------------------- \n");
printf("\t\t\t\t\t | [1] Withdraw money |\n");
printf("\t\t\t\t\t | [2] Deposit |\n");
printf("\t\t\t\t\t | [3] Making Money Transfer |\n");
printf("\t\t\t\t\t | [4] Balance Query |\n");
printf("\t\t\t\t\t | [5] Card Refund |\n");
printf("\t\t\t\t\t -------------------------------------- \n\n");
}
else {
printf("\n\t\t\t\t\t\t\t ISLEMLER\n\n");
printf("\t\t\t\t\t -------------------------------------- \n");
printf("\t\t\t\t\t | [1] Para Cekme |\n");
printf("\t\t\t\t\t | [2] Para Yatirma |\n");
printf("\t\t\t\t\t | [3] Havale Yapma |\n");
printf("\t\t\t\t\t | [4] Bakiye Sorgulama |\n");
printf("\t\t\t\t\t | [5] Kart Iade |\n");
printf("\t\t\t\t\t -------------------------------------- \n\n");
}
if(language == 1) {
printf("\t\t\t\t\t Select the action: ");
}
else {
printf("\t\t\t\t\t Islem seciniz: ");
}
scanf("%d", &islem);
switch(islem) {
//1. TR: Para çekme - EN: Withdraw money
case 1 :
if(language == 1) {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Your balance : %d\n", bakiye);
}
else {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Bakiyeniz : %d\n", bakiye);
}
if(language == 1) {
printf("\t\t\t\t\t Amount to withdraw : ");
}
else {
printf("\t\t\t\t\t Cekilecek miktar : ");
}
scanf("%d", &tutar);
if (tutar > bakiye) {
if(language == 1) {
printf("\t\t\t\t\t\a Insufficient balance!\n");
sleep(1);
system("CLS");
calistir();
}
else {
printf("\n\t\t\t\t\t\a Yetersiz Bakiye!\n");
sleep(1);
system("CLS");
calistir();
}
}
bakiye -= tutar;
if(language == 1) {
printf("\t\t\t\t\t Your remaining balance : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------\n");
}
else {
printf("\t\t\t\t\t Kalan Bakiyeniz : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------");
}
break;
//2. TR: Para yatýrma - EN: Deposit money
case 2 :
if(language == 1) {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Your balance : %d\n", bakiye);
}
else {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Bakiyeniz : %d\n", bakiye);
}
if(language == 1) {
printf("\t\t\t\t\t Amount to be deposited : ");
}
else {
printf("\t\t\t\t\t Yatirilacak tutar : ");
}
scanf("%d", &tutar);
bakiye += tutar;
if(language == 1) {
printf("\t\t\t\t\t Your curret balance : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------\n");
}
else {
printf("\t\t\t\t\t Guncel bakiyeniz : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------");
}
break;
//TR: Havale yapma - EN: Making a transfer
case 3 :
if(language == 1) {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Your balance : %d\n", bakiye);
}
else {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Bakiyeniz : %d\n", bakiye);
}
if(language == 1) {
printf("\t\t\t\t\t Amount to be transferred : ");
}
else {
printf("\t\t\t\t\t Havale yapilacak tutar : ");
}
scanf("%d", &tutar);
if (tutar > bakiye) {
if(language == 1) {
printf("\t\t\t\t\t\a Insufficient balance!\n");
sleep(1);
system("CLS");
calistir();
}
else {
printf("\n\t\t\t\t\t\a Yetersiz Bakiye!\n");
sleep(1);
system("CLS");
calistir();
}
}
bakiye -= tutar;
if(language == 1) {
printf("\t\t\t\t\t Your remaining balance : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------");
}
else {
printf("\t\t\t\t\t Kalan Bakiyeniz : %d", bakiye);
printf("\n\n\t\t\t\t\t ----------------------------------------");
}
break;
//TR: Bakiye sorgulama - EN: Balance query
case 4 :
if(language == 1) {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Your balance : %d\n", bakiye);
printf("\n\t\t\t\t\t ----------------------------------------");
}
else {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Bakiyeniz : %d\n", bakiye);
printf("\n\t\t\t\t\t ----------------------------------------");
}
break;
//TR: Kard iade - EN: Card returns
case 5 :
if(language == 1) {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t The card has been returned. ");
printf("\n\n\t\t\t\t\t ----------------------------------------");
return;
}
else {
printf("\n\t\t\t\t\t ----------------------------------------\n\n");
printf("\t\t\t\t\t Kart iade edildi.");
printf("\n\n\t\t\t\t\t ----------------------------------------");
return;
}
break;
//TR: Yanlýþ sayý girimi - EN: Wrong number entry
default :
if(language == 1) {
system("CLS");
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("\t\t\t\t ---------------------------------------------------------\n");
printf("\t\t\t\t * Error! Please enter the numbers requested from you. *\n");
printf("\t\t\t\t ---------------------------------------------------------\n");
}
else {
system("CLS");
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("\t\t\t\t ---------------------------------------------------------\n");
printf("\t\t\t\t * Hata! Lutfen sizden istenen numaralari giriniz. *\n");
printf("\t\t\t\t ---------------------------------------------------------\n");
}
break;
}
int durum;
if(language == 1) {
printf("\n\n\t\t\t\t\t\a Do you want to leave the Virtual Bank?\n\t\t\t\t\t\tYES = 1, TURN BACK = 2 : ");
}
else {
printf("\n\n\t\t\t\t\t\a Sanal Bankadan ayrilmak istiyor musunuz?\n\t\t\t\t\t\tEVET = 1, GERI DON = 2 : ");
}
scanf("%d", &durum);
if(durum == 2){
system("CLS");
calistir();
}
}