-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank Management System.cpp
881 lines (879 loc) · 23.1 KB
/
Bank Management System.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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
//------------------------structure-----------------------------------//
struct data1
{
int account_no;
char name[30];
char city[30];
char state[30];
char zip[6];
char phone_no[12];
double account_balance;
int date;
int month;
int year;
};
//--------------------function for adding new account-----------------//
void add_account()
{
srand(time(NULL));
data1 add;
ofstream datafile;
datafile.open("ACCOUNT.txt", ios::out | ios::app);//opening file to write data to file
add.account_no = rand();
cout << "\t\tYOUR ACCOUNT ID IS : " << add.account_no;
cin.ignore();
cout<<endl;
cout<<endl;
cout << "\t\tENTER YOUR FULL NAME : ";
cin.getline(add.name, 30);
while (strlen(add.name) == 0)//user must enter the name field
{
cout << "\t\tYOU CANNOT LEFT THE FIELD (NAME) BLANK : ";
cin.getline(add.name, 30);
}
cout << "\t\tENTER THE CITY NAME : ";
cin.getline(add.city, 30);
while (strlen(add.city) == 0)//user must enter the city field
{
cout << "\t\tYOU CANNOT LEFT THE FIELD (CITY) BLANK : ";
cin.getline(add.city, 30);
}
cout << "\t\tENTER THE STATE : ";
cin.getline(add.state, 30);
while (strlen(add.state) == 0)//user must enter the state field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (STATE) BLANK : ";
cin.getline(add.state, 30);
}
cout << "\t\tENTER THE ZIP-CODE : ";
cin.getline(add.zip, 6);
while (strlen(add.zip) == 0)//user must enter the zip code field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (ZIP-CODE) BLANK : ";
cin.getline(add.zip, 6);
}
cout << "\t\tENTER THE PHONE NUMBER : ";
cin.getline(add.phone_no, 12);
while (strlen(add.phone_no) == 0)//user must enter the phone number field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (PHONE-NO) BLANK : ";
cin.getline(add.phone_no, 12);
}
cout << "\t\tENTER THE ACCOUNT BALANCE $ : ";
cin >> add.account_balance;
while (add.account_balance<0)//balance cant be negative
{
cout << "\t\tACCOUNT BALANCE CAN'T BE NEGATIVE\n";
cin >> add.account_balance;
}
cin.ignore();
label:
cout << "\t\tENTER THE LAST PAYMENT DATE (DATE) : ";
cin>>add.date;
cin.ignore();
while(add.date>31 || add.date <1)
{
cout<<"\t\tERROR IN DATE (DATE) !!"<<endl;
cin>>add.date;
}
label1:
cout << "\t\tENTER THE LAST PAYMENT DATE (MONTH) : ";
cin>>add.month;
cin.ignore();
if(add.month>12 ||add.month <1)
{
cout<<"\t\tERROR IN DATE (MONTH) !! ";
goto label1;
}
cout << "\t\tENTER THE LAST PAYMENT DATE (YEAR) : ";
cin>>add.year;
cout << endl;
cout << endl;
//witing structure to file
datafile.write(reinterpret_cast<char *>(&add), sizeof(add));
cout << "\t\tACCOUNT SUCCESFULLY CREATED !! " << endl;
datafile.close();
}
//--------------------function to view all records------------------------------------------------
void view_all()
{
data1 view;
char again;
ifstream datafile;//opening file to read the file
datafile.open("ACCOUNT.txt", ios::in);
if (!datafile)//checking if file exist
{
cout << endl;
cout << "\t\tERROR !! IN OPENING FILE " << endl;
cout << endl;
}
else//if file exist then reading struture from the file
{
datafile.read(reinterpret_cast<char *>(&view), sizeof(view));
int i = 1;
while (!datafile.eof())
{
cout << "\t\t\t\tRECORD # " << i << endl;
cout << "\t\t============================================" << endl;
cout << "\t\tACCOUNT-NUMBER : " << view.account_no << endl;
cout << "\t\tNAME : " << view.name << endl;
cout << "\t\tCITY : " << view.city << endl;
cout << "\t\tSTATE : " << view.state << endl;
cout << "\t\tZIP-CODE : " << view.zip << endl;
cout << "\t\tPHONE-NUMBER : " << view.phone_no << endl;
cout << "\t\tACCOUNT BALANCE $ : " << view.account_balance << endl;
cout << "\t\tLAST PAYMENT DATE : " << view.date<<"-"<<view.month<<"-"<<view.year << endl;;
cout << endl;
cout << "\t\t============================================" << endl;
i++;
datafile.read(reinterpret_cast<char *>(&view), sizeof(view));
}
cout << "\t\tTHIS IS ALL THE RECORD WE HAVE . THANK YOU !!" << endl;
cout << "\t\t============================================" << endl;
}
datafile.close();
}
//------------------------------------function to delete all records----------------------------
void delete_all()
{
fstream datafile;
if (datafile)//if exist exist del all records
{
remove("ACCOUNT.txt");
cout << endl;
cout << "\t\tRECORD DELETED SUCCESSFULLY !! " << endl;
}
else// if file doesnt exist
{
cout << endl;
cout << "\t\tERROR !! IN OPENING FILE " << endl;
}
}
//-----------------------------function for search specific record------------------------------
void specific_search()
{
data1 search;
int num;
int temp;
cout << "\t\tENTER THE ID YOU WANT TO SEARCH FOR RECORD : ";
cin >> num;
ifstream datafile;
datafile.open("ACCOUNT.txt");
datafile.read(reinterpret_cast<char *>(&search), sizeof(search));
if (!datafile)
{
cout << "\t\tERROR !! IN OPENING FILE : " << endl;
}
while (!datafile.eof())
{
temp = search.account_no;
if (num == search.account_no)
{
cout << endl;
cout << "\t\t============================================" << endl;
cout << "\t\tACCOUNT NO : " << search.account_no << endl;
cout << "\t\tNAME : " << search.name << endl;
cout << "\t\tCITY : " << search.city << endl;
cout << "\t\tSTATE : " << search.state << endl;
cout << "\t\tZIP-CODE : " << search.zip << endl;
cout << "\t\tPHONE-NUMBER : " << search.phone_no << endl;
cout << "\t\tACCOUNT BALANCE : " << search.account_balance << endl;
cout << "\t\tLAST PAYMENT DATE : " << search.date<<"-"<<search.month<<"-"<<search.year << endl;
cout << "\t\t============================================" << endl;
}
datafile.read(reinterpret_cast<char *>(&search), sizeof(search));
}
datafile.close();
if (num != temp)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! " << endl;
}
}
void balance_inquiry()
{
data1 inquiry;
int num;
int temp;
cout << "\t\tENTER THE ACCOUNT NUMBER FOR WHICH YOU WANT" << endl;
cout << "\t\tTO PERFORM BALANCE INQUIRY !! ";
cin >> num;
ifstream datafile;
datafile.open("ACCOUNT.txt");
datafile.read(reinterpret_cast<char *>(&inquiry), sizeof(inquiry));
while (!datafile.eof())
{
temp = inquiry.account_no;
if (num == inquiry.account_no)
{
cout << endl;
cout << "\t\t============================================" << endl;
cout << "\t\tDEAR !! " << inquiry.name << ". " << endl;
cout << endl;
cout << "\t\tYOU ACCOUNT BALANCE IS : " << inquiry.account_balance << "$" << endl;
cout << "\t\tYOUR LAST PAYMENT DATE IS : " << inquiry.date<<"-"<<inquiry.month<<"-"<<inquiry.year << endl;
cout << "\t\t============================================" << endl;
}
datafile.read(reinterpret_cast<char *>(&inquiry), sizeof(inquiry));
}
datafile.close();
if (num != temp)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! " << endl;
}
}
void delete_record()
{
data1 del;
int num;
int temp;
cout << "\t\tENTER YOUR ACCOUNT NUMBER FOR WHICH YOU WANT TO DELETE RECORD !! ";
cin >> num;
ifstream infile;
ofstream outfile;
infile.open("ACCOUNT.txt", ios::in);
if (!infile)
{
cout << "\t\tERROR !! IN OPENING FILE " << endl;
}
if (infile)
{
outfile.open("TEMP.txt", ios::out);
infile.read(reinterpret_cast<char *>(&del), sizeof(del));
while (!infile.eof())
{
temp = del.account_no;
if (num == del.account_no)
{
cout << endl;
cout << "\t\tRECORD DELETED SUCCESSFULLY !! " << endl;
}
if (num != del.account_no)
{
outfile.write(reinterpret_cast<char *>(&del), sizeof(del));
}
infile.read(reinterpret_cast<char *>(&del), sizeof(del));
}
infile.close();
outfile.close();
remove("ACCOUNT.txt");
rename("TEMP.txt", "ACCOUNT.txt");
}
if (num != temp)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! " << endl;
}
}
void deposit_amount()
{
data1 deposit;
int num;
int temp;
int amount;
int sum;
cout << "\t\tENTER YOUR ACCOUNT NUMBER FOR WHICH YOU WANT TO DEPOSIT MONEY !! ";
cin >> num;
ifstream infile;
ofstream outfile;
infile.open("ACCOUNT.txt", ios::in);
if (!infile)
{
cout << "\t\tFILE OPENING ERROR !! " << endl;
}
if (infile)
{
outfile.open("TEMP.txt", ios::out);
infile.read(reinterpret_cast<char *>(&deposit), sizeof(deposit));
while (!infile.eof())
{
temp = deposit.account_no;
if (num == deposit.account_no)
{
cout << endl;
cout << "\t\tENTER THE AMOUNT YOU WANT TO DEPOSIT !! ";
cin >> amount;
deposit.account_balance = amount + deposit.account_balance;
cout << "\t\t============================================" << endl;
cout << "\t\tDEAR !! " << deposit.name << " ." << endl;
cout << endl;
cout << "\t\tYOUR CURRENT ACCOUNT BALANCE IS NOW : " << deposit.account_balance << "$" << endl;
cout << "\t\t============================================" << endl;
outfile.write(reinterpret_cast<char *>(&deposit), sizeof(deposit));
}
if (num != deposit.account_no)
{
outfile.write(reinterpret_cast<char *>(&deposit), sizeof(deposit));
}
infile.read(reinterpret_cast<char *>(&deposit), sizeof(deposit));
}
infile.close();
outfile.close();
remove("ACCOUNT.txt");
rename("TEMP.txt", "ACCOUNT.txt");
}
if (num != temp)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! " << endl;
}
}
void amount_withdraw()
{
data1 withdraw;
int num;
int temp;
int amount;
int sum;
cout << "\t\tENTER YOUR ACCOUNT NUMBER FOR WHICH YOU WANT TO WITHDRAW MONEY !! ";
cin >> num;
ifstream infile;
ofstream outfile;
infile.open("ACCOUNT.txt", ios::in);
if (!infile)
{
cout << "\t\tERROR !! IN FILE OPENING " << endl;
}
if (infile)
{
outfile.open("TEMP.txt", ios::out);
infile.read(reinterpret_cast<char *>(&withdraw), sizeof(withdraw));
while (!infile.eof())
{
temp = withdraw.account_no;
if (num == withdraw.account_no)
{
cout << endl;
label0:
cout << "\t\tENTER THE AMOUNT YOU WANT TO WITHDRAW !! ";
cin >> amount;
if (amount > withdraw.account_balance)
{
cout << endl;
cout << "\t\tINSUFFIANCE BALANCE !! " << endl;
cout << endl;
goto label0;
}
withdraw.account_balance = withdraw.account_balance - amount;
cout << "\t\t============================================" << endl;
cout << "\t\tDEAR !! " << withdraw.name << " ." << endl;
cout << endl;
cout << "\t\tYOUR CURRENT REMAINING ACCOUNT BALANCE IS NOW : " << withdraw.account_balance << "$" << endl;
cout << "\t\t============================================" << endl;
outfile.write(reinterpret_cast<char *>(&withdraw), sizeof(withdraw));
}
if (num != withdraw.account_no)
{
outfile.write(reinterpret_cast<char *>(&withdraw), sizeof(withdraw));
}
infile.read(reinterpret_cast<char *>(&withdraw), sizeof(withdraw));
}
infile.close();
outfile.close();
remove("ACCOUNT.txt");
rename("TEMP.txt", "ACCOUNT.txt");
}
if (num != temp)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! " << endl;
}
}
void update_record()
{
data1 update;
int num;
cout<<endl;
cout<<"\t\tENTER THE ACCOUNT NUMBER TO UPDATE RECORD : ";
cin>>num;
ifstream infile;
ofstream outfile;
infile.open("ACCOUNT.txt" , ios::in);
if(!infile)
{
cout<<endl;
cout<<"ERROR !! IN OPENING FILE "<<endl;;
}
if(infile)
{
outfile.open("TEMP.txt" , ios::out);
infile.read(reinterpret_cast<char *>(&update) , sizeof(update));
while(!infile.eof())
{
if(num==update.account_no)
{
cin.ignore();
cout << "\t\tENTER YOUR FULL NAME : ";
cin.getline(update.name, 30);
while (strlen(update.name) == 0)//user must enter the name field
{
cout << "\t\tYOU CANNOT LEFT THE FIELD (NAME) BLANK : ";
cin.getline(update.name, 30);
}
cout << "\t\tENTER THE CITY NAME : ";
cin.getline(update.city, 30);
while (strlen(update.city) == 0)//user must enter the city field
{
cout << "\t\tYOU CANNOT LEFT THE FIELD (CITY) BLANK : ";
cin.getline(update.city, 30);
}
cout << "\t\tENTER THE STATE : ";
cin.getline(update.state, 30);
while(strlen(update.state) == 0)//user must enter the state field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (STATE) BLANK : ";
cin.getline(update.state, 30);
}
cout << "\t\tENTER THE ZIP-CODE : ";
cin.getline(update.zip, 6);
while (strlen(update.zip) == 0)//user must enter the zip code field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (ZIP-CODE) BLANK : ";
cin.getline(update.zip, 6);
}
cout << "\t\tENTER THE PHONE NUMBER : ";
cin.getline(update.phone_no, 12);
while (strlen(update.phone_no) == 0)//user must enter the phone number field
{
cout << "\t\tYOU CANNOT LEFT THIS FIELD (PHONE-NO) BLANK : ";
cin.getline(update.phone_no, 12);
}
cout << "\t\tENTER THE ACCOUNT BALANCE $ : ";
cin >> update.account_balance;
while (update.account_balance<0)//balance cant be negative
{
cout << "\t\tACCOUNT BALANCE CAN'T BE NEGATIVE\n";
cin >> update.account_balance;
}
cin.ignore();
label:
cout << "\t\tENTER THE LAST PAYMENT DATE (DATE) : ";
cin>>update.date;
cin.ignore();
if(update.date>31 || update.date <1)
{
cout<<"\t\tERROR IN DATE (DATE) !!"<<endl;//DATE VALIDATION ACCORDING TO DATE
goto label;
}
label1:
cout << "\t\tENTER THE LAST PAYMENT DATE (MONTH) : ";
cin>>update.month;
cin.ignore();
if(update.month>12 ||update.month <1)
{
cout<<"\t\tERROR IN DATE (MONTH) !! "<<endl;//DATE VALIDATION ACCORDING TO MONTH
goto label1;
}
cout << "\t\tENTER THE LAST PAYMENT DATE (YEAR) : ";
cin>>update.year;
}
outfile.write(reinterpret_cast<char *>(&update) , sizeof(update));
infile.read(reinterpret_cast<char *>(&update) , sizeof(update));
}
infile.close();
outfile.close();
remove("ACCOUNT.txt");
rename("TEMP.txt" , "ACCOUNT.txt");
}
}
int amount_transfer()
{
data1 transfer;
label:
int acc1;
int acc2;
int temp1;
int temp2;
int amount;
cout << "\t\tENTER THE ACCOUNT # OF SENDER : ";
cin >> acc1;
cout << "\t\tENTER THE ACCOUNT # OF RECEIVER : ";
cin >> acc2;
if (acc1 == acc2)
{
cout << endl;
cout << "\t\tACCOUNT # CANNOT BE SAME !! " << endl;
cout << endl;
goto label;
}
cout << endl;
cout << "\t\tENTER THE AMOUNT TO DEPOSIT : ";
cin >> amount;
ifstream infile;
ofstream outfile;
infile.open("ACCOUNT.txt", ios::in);
if (!infile)
{
cout << "ERROR !! IN OPENING FILE " << endl;
cout << endl;
}
if (infile)
{
outfile.open("TEMP.txt", ios::out);
infile.read(reinterpret_cast<char *>(&transfer), sizeof(transfer));
while (!infile.eof())
{
temp1 = transfer.account_no;
if (acc1 == transfer.account_no)
{//CHECK FOR THE SENDER ACCOUNT NUMBER
if (amount > transfer.account_balance)
{
cout << endl;
cout << "\t\tINSUFFIANT BALANCE !! " << endl;
return 0;
}
transfer.account_balance = transfer.account_balance - amount;
}
else if (acc2 == transfer.account_no)
{
//CHECK FOR THE RECEIVER ACCOUNT NUMBER
temp2 = transfer.account_no;
transfer.account_balance = transfer.account_balance + amount;
}
outfile.write(reinterpret_cast<char *>(&transfer), sizeof(transfer));
infile.read(reinterpret_cast<char *>(&transfer), sizeof(transfer));
}
if (acc1 != temp1)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! ";
cout << endl;
return 0;
}
if (acc2 != temp2)
{
cout << endl;
cout << "\t\tRECORD NOT FOUND !! ";
cout << endl;
return 0;
}
}
infile.close();
outfile.close();
remove("ACCOUNT.txt");
rename("TEMP.txt", "ACCOUNT.txt");
return 0;
}
int main()
{
label:
system("cls");
int choice;
char choices;
cout << endl;
cout << "\t\t============================================" << endl;
cout << "\t\t CUSTOMER ACCOUNT MANAGEMENT SYSTEM" << endl;
cout << "\t\t============================================" << endl;
cout << endl;
cout << "\t\t<ENTER 0> TO ADD A NEW RECORD" << endl;
cout << "\t\t<ENTER 1> TO SEARCH FOR RECORD TO DISPLAY" << endl;
cout << "\t\t<ENTER 2> TO SEARCH FOR RECORD TO DELETE" << endl;
cout << "\t\t<ENTER 3> TO SEARCH FOR RECORD TO UPDATE " << endl;
cout << "\t\t<ENTER 4> TO VIEW ALL RECORDS LIST" << endl;
cout << "\t\t<ENTER 5> TO DELETE ALL RECORDS COMPLTELY" << endl;
cout << "\t\t<ENTER 6> TO BALANCE INQUIRY" << endl;
cout << "\t\t<ENTER 7> TO DEPOSIT AMMOUNT" << endl;
cout << "\t\t<ENTER 8> TO WITHDRAW AMOUNT" << endl;
cout << "\t\t<ENTER 9> TO TRANSFER AMOUNT TO ANOTHER ACCOUNT" << endl;
cout << "\t\t<ENTER 10> TO EXIT FROM MENU " << endl;
cout << endl;
cout << "\t\t============================================" << endl;
cout << endl;
cout << "\t\tENTER YOUR CHOICE <0-10> !! ";
cin >> choice;
cout << endl;
if (choice == 0)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO ADD A NEW RECORD !! " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
add_account();//FUNCTION FOR ADDING NEW ACCOUNT
cout << endl;
label1:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label1;
}
}
else if (choice == 1)
{
char choices;
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\tYOUR ARE GOING TO DISPLAY SPECIFIC RECORD !! " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
specific_search();//FUNCTION FOR SPECIFICALLY SEARCHING AN ACCOUNT
cout << endl;
label2:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !! " << endl;
goto label2;
}
}
else if (choice == 2)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO DELETE THE RECORD !! " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
delete_record();//FUNCTION FOR DELETING A SPECIFIC ACCOUNT
cout << endl;
label5:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label5;
}
}
else if (choice == 3)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO UPDATE THE RECORD !! " << endl;
cout << "\t\t============================================" << endl;
update_record();//FUNCTION FOR UPDATING A RECORD SPECIFIC ACCOUNT
cout << endl;
label9:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label9;
}
}
else if (choice == 4)
{
char choices;
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO VIEW ALL RECORD !! " << endl;
cout << "\t\t============================================" << endl;
view_all();//FUNCTION FOR VIEWING ALL ACCOUNTS IN THE FILE
label3:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label3;
}
}
else if (choice == 5)
{
system("cls");
char choice1;
char choice2;
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO DELETE ALL RECORDS " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
cout << "\t\tARE YOU SURE YOU WANT TO DELETE ALL RECORDS (Y/N) !! ";
cin >> choice1;
if (choice1 == 'Y' || choice1 == 'y')
{
delete_all();//FUNCTION FOR DELETING ALL THE ACCOUNTS IN THE FILE
cout << endl;
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) !! ";
cin >> choice2;
if (choice2 == 'Y' || choice2 == 'y')
{
goto label;
}
else
{
exit(0);
}
}
else if (choice1 == 'N' || choice1 == 'n')
{
cout << endl;
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) !! ";
cin >> choice2;
if (choice2 == 'Y' || choice2 == 'y')
{
goto label;
}
else
{
exit(0);
}
}
else
{
exit(0);
}
}
else if (choice == 6)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\tYOU ARE GOING TO ATTEMPT THE BALANCE INQUIRY !! " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
balance_inquiry();//FUNCTION FOR BALANCE INQUIRY
cout << endl;
label4:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label4;
}
}
else if (choice == 7)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\t YOU ARE GOING TO DEPOSIT AMOUNT !! " << endl;
cout << "\t\t============================================" << endl;
cout << endl;
deposit_amount();
cout << endl;
label6:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label6;
}
}
else if (choice == 8)
{
system("cls");
cout << "\t\t============================================" << endl;
cout << "\t\tYOU ARE GOING TO WITHDRAW AMOUNT !! " << endl;
cout << "\t\t============================================" << endl;
amount_withdraw();//FUNCTION FOR WITHDRAW THE AMMOUNT FROM ACCOUNT
cout << endl;
label7:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label7;
}
}
else if (choice == 9)
{
system("cls");
cout << "\t\t============================================================" << endl;
cout << "\t\t YOU ARE GOING TO TRANSFER AMOUNT TO ANOTHER ACCOUNT !! " << endl;
cout << "\t\t============================================================" << endl;
cout << endl;
amount_transfer();
cout << endl;
label8:
cout << "\t\tDO YOU WANT TO GO BACK (Y/N) ? ";
cin >> choices;
if (choices == 'Y' || choices == 'y')
{
goto label;
}
else if (choices == 'N' || choices == 'n')
{
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !!" << endl;;
goto label8;
}
}
else if (choice == 10)
{
cout << "\t\tTHANK YOU !! FOR VISITING THE MENU " << endl;
exit(0);
}
else
{
cout << "\t\tINVALID CHOICE !! " << endl;
}
}