-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBankingManagement.cpp
446 lines (395 loc) · 14.1 KB
/
BankingManagement.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
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
class Account
{
private:
string firstna;
string lastna;
string fathname;
long long int adhar;
string mobile;
string email;
int initialbal;
char wantATM;
char wantCheque;
long int accountno;
public:
Account(){
}
Account(string a, string b, string c, long long int d, string e, string f, int g, char h, char i, long int k)
{
firstna = a;
lastna = b;
fathname = c;
adhar = d;
mobile = e;
email = f;
initialbal = g;
wantATM = h;
wantCheque = i;
accountno = k;
}
friend ofstream &operator<<(ofstream &out, Account &openacc);
friend ifstream &operator>>(ifstream &intt, Account &showacc);
friend ostream &operator<<(ostream &mop, Account &popo);
};
ofstream &operator<<(ofstream &piujr, Account &openacc)
{
piujr << openacc.accountno << endl;
piujr << openacc.initialbal << endl;
piujr << openacc.firstna << endl;
piujr << openacc.lastna << endl;
piujr << openacc.mobile << endl;
piujr << openacc.email << endl;
return piujr;
}
ifstream &operator>>(ifstream &intt, Account &shacc)
{
intt>>shacc.accountno;
intt>>shacc.initialbal;
intt>>shacc.firstna;
intt>>shacc.lastna;
intt>>shacc.mobile;
intt>>shacc.email;
return intt;
}
ostream &operator<<(ostream &mop, Account &popo)
{
mop << "Account Number: - " << popo.accountno << endl;
mop << "Balance in Account : - " << popo.initialbal << endl;
mop << "First Name : - " << popo.firstna << endl;
mop << "Last Name : - " << popo.lastna << endl;
mop << "Mobile Number: - " << popo.mobile << endl;
mop << "Email Id : - " << popo.email << endl;
return mop;
}
int main()
{
Account cand;
string ordname;
int choice;
ofstream accout("accfile.txt", ios::app);
ifstream accin("accfile.txt");
int count1 = 0;
map<long long int, int> ao;
string firstna;
string lastna;
string fathname;
long long int adhar;
string mobile;
string email;
int initialbal;
char wantATM;
char wantCheque;
long int accountno;
long int rando = 98765432;
long int acc2;
int amou2;
map<long long int, int>::iterator itr;
int acc4;
long int acc3;
long int acc5;
long int acc6;
long int acc7;
char anss;
long int amou3;
cout << setw(70) << "STATE BANK OF INDIA" << endl;
cout << setw(70) << "---------------------" << endl;
cout << " " << endl;
cout << ".............Welcome To SBI Bank .........." << endl;
cout << " " << endl;
cout << "-:Enter Your Full Name:-" << endl;
getline(cin, ordname);
cout<<" "<<endl;
cout << "Welcome " << ordname << " to SBI Bank .. "<< endl;
// cout<<setw(48)<<"----------------"<<endl;
cout << " " << endl;
cout<<" "<<endl;
label:
cout << "Enter A choice from below options" << endl;
cout << " " << endl;
cout << " 1. Open An Account " << endl;
cout << " 2. Deposit Amount " << endl;
cout << " 3. Withdraw Amount " << endl;
cout << " 4. Balance Enquiry " << endl;
cout << " 5. Request for a Cheque Book " << endl;
cout << " 6. Request for an ATM Card " << endl;
cout << " 7. Block ATM Card " << endl;
cout << " 8. Show All Accounts" << endl;
cin >> choice;
switch (choice)
{
case 1: //completed
{
cout << " " << endl;
cout << "Thanks! For Choosing Account in SBI Bank" << endl;
cout << " " << endl;
cout << "STEP 1 : Personal Detials" << endl;
cout << " " << endl;
cout << "Enter your First Name:- " << endl;
cin >> firstna;
cout << "Enter your Last Name:- " << endl;
cin >> lastna;
cout << "Enter your Fathers First Name:- " << endl;
cin>>fathname;
//getline(cin, fathname);
// cin.ignore();
cout << "Enter Your Aadhar Card Number:- " << endl;
cin >> adhar;
cout << "Enter Your Mobile Number:- " << endl;
cin >> mobile;
for (int z = 2; z < 8; z++)
{
mobile[z] = 'X';
}
cout << "Enter Your Email id :- " << endl;
cin >> email;
cout << "STEP 2 : BANK Detials" << endl;
cout << " " << endl;
cout << "Enter Initial Amount you want to be deposit :- " << endl;
cout << " " << endl;
cout << "Min Amount to be deposit is Rs. 1000" << endl;
cin >> initialbal;
if(initialbal<1000){
cout<<" "<<endl;
cout<<"Please deposit aleast 1000 Rs"<<endl;
cout<<" "<<endl;
cout<<"Enter Again Amount you want to be depsit"<<endl;
cin>>initialbal;
}
cout << "You Want ATM Card deliver at your home , Reply with 'Y' for Yes and 'N' for No" << endl;
cin >> wantATM;
cout << "You Want Cheque Book deliver at your home , Reply with 'Y' for Yes and 'N' for No" << endl;
cin >> wantCheque;
accountno = rando;
rando = rando + 1841;
ao.insert(pair<long long int,int> (accountno, initialbal));
cout << " " << endl;
cout << "Congratulations ! Your Account is Created " << endl;
cout << "-------------------------------------------" << endl;
cout << "Your Account Number is:- " << accountno << endl;
cout << "Your Name: - " << firstna << " " << lastna << endl;
cout << "Mobile Number:- " << mobile << endl;
cout << "Account Balance:- " << initialbal << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout << " " << endl;
cout << "-------------------------------------------" << endl;
count1++;
Account cand (firstna, lastna, fathname, adhar, mobile, email, initialbal, wantATM, wantCheque, accountno);
accout << cand;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
}
case 2:
cout << "Deposit Amount....." << endl;
cout << " " << endl;
cout << "Enter Your Account No" << endl;
cin >> acc2;
cout << "Enter Amount you want to add" << endl;
cin >> amou2;
cout << "You have sucessfully Deposited " << amou2 << "Rs..." << endl;
itr = ao.find(acc2);
itr->second = itr->second + amou2;
cout<<" "<<endl;
cout << "Your Current Balance is Rs " << itr->second << endl;
cout << " " << endl;
cout << "Thanks For Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 3:
cout << "Withdraw Amount....." << endl;
cout << " " << endl;
cout << "Enter Your Account No:- " << endl;
cin >> acc3;
cout << "Enter Amount you want to withdraw : -" << endl;
cin >> amou3;
itr = ao.find(acc3);
itr->second = itr->second - amou3;
if (itr->second < 0)
{
cout << "Please Enter Valid Amount" << endl;
cin>>amou3;
itr = ao.find(acc3);
itr->second = itr->second - amou3;
}
else if (itr->second < 1000)
{
cout << "The minimum amount must be Rs 1000" << endl;
cout<<"Enter Again Amount.."<<endl;
cin>>amou3;
itr = ao.find(acc3);
itr->second = itr->second - amou3;
}
cout << "You have sucessfully Withdrawl " << amou3 << "Rs..." << endl;
cout << "Your Current Balance is :- Rs " << itr->second << endl;
cout << " " << endl;
cout << "Thanks For Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 4:
cout << "Balance Enquiry " << endl;
cout << "Enter Your Account Number: - " << endl;
cin >> acc4;
itr = ao.find(acc4);
cout << " Your Balance is:- " << itr->second << endl;
cout << " " << endl;
cout << "Thanks For Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 5:
//int acc5;
cout << "Request For Cheque Book" << endl;
cout << " " << endl;
cout << "Enter Your Account Number: - " << endl;
cin >> acc5;
cout << "OKAY! Your Request is under Process" << endl;
cout << " " << endl;
cout << "Thanks for Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 6:
//int acc6;
cout << "Request For ATM Card" << endl;
cout << " " << endl;
cout << "Enter Your Account Number: - " << endl;
cin >> acc6;
cout << "OKAY! Your Request is under Process" << endl;
cout << " " << endl;
cout << "Thanks for Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 7:
// int acc7;
cout << "Request For Block ATM Card" << endl;
cout << " " << endl;
cout << "Enter Your Account Number: - " << endl;
cin >> acc7;
cout << "OKAY! Your Request is under Process" << endl;
cout << " " << endl;
cout << "Thanks for Visiting SBI" << endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
case 8:{
cout << " All Accounts registered on this portal are : " << endl;
cout<<" "<<endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
for (int b5 = 1; b5 <= count1; b5++)
{
cout << "Account No.- " << b5 << endl;
accin >> cand;
cout << cand << endl;
}
cout<<" "<<endl;
cout<<"Do You want to continue or exit the portal"<<endl;
cout<<"Reply with 'Y' for Continue and 'N' for exit portal"<<endl;
cin>>anss;
if(anss == 'Y'){
goto label;
}
else if(anss= 'N'){
goto end;
}
break;
}
default:
cout << "Please Choose appropriate choice " << endl;
cout<<"Choose Again..."<<endl;
cout<<" "<<endl;
goto label;
break;
}
end:
cout<<" "<<endl;
cout<<"Current Date:- "<<__DATE__<<endl;
cout<<"Current Time:- "<<__TIME__<<endl;
cout<<" "<<endl;
cout << ".....Thanks For Visiting SBI Bank..... " << endl;
cout << " " << endl;
cout << "Exit in 3 seconds .............." << endl;
return 0;
}