Skip to content

Commit 59fdd9a

Browse files
committed
Updated bank management system
1 parent 9727191 commit 59fdd9a

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

Bank management system/BMS.cpp renamed to Bank management system/main.cpp

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Header.h"
22

3-
int main() {
3+
int main()
4+
{
45
srand(time(0));
56
::available = rand() % 200000;
67
MainMenu();
@@ -10,12 +11,14 @@ int main() {
1011
return 0;
1112
}
1213

13-
void MainMenu() {
14+
void MainMenu()
15+
{
1416
system("color 9E");
1517
char num;
1618
char choice;
17-
do {
18-
19+
do
20+
{
21+
1922
bool checked = false;
2023
string checkName, checkPassword;
2124
accounts data;
@@ -37,48 +40,56 @@ void MainMenu() {
3740
cout << "\n Please enter your password:";
3841
cout << "\n ";
3942
cin >> checkPassword;
40-
for (int i = 0;i<::increaments; i++) {
41-
42-
if (oldData[i].name == checkName && oldData[i].password == checkPassword) {
43+
for (int i = 0; i < ::increaments; i++)
44+
{
45+
46+
if (oldData[i].name == checkName && oldData[i].password == checkPassword)
47+
{
4348
::accountNum = i;
4449
::balance = oldData[i].balance;
4550
::borrow = oldData[i].borrowed;
4651
checked = true;
4752
}
48-
4953
}
50-
if (checked) {
51-
do {
54+
if (checked)
55+
{
56+
do
57+
{
5258
system("CLS");
53-
cout << "\n Hello "<<oldData[::accountNum].name << endl;
59+
cout << "\n Hello " << oldData[::accountNum].name << endl;
5460
cout << "\n What would you like to do?" << endl;
5561
cout << "\n 1.Actions with card" << endl;
5662
cout << "\n 2.Check balance" << endl;
5763
cout << "\n 0.Exit" << endl;
5864
num = _getch();
59-
switch (num) {
65+
switch (num)
66+
{
6067
case 48:
6168
break;
62-
case 49: Menu(oldData);
69+
case 49:
70+
Menu(oldData);
6371
break;
64-
case 50: CheckBalance();
72+
case 50:
73+
CheckBalance();
6574
break;
6675
default:
67-
cout << "\n Error! Section not found. Please try one more time." << endl << endl;
76+
cout << "\n Error! Section not found. Please try one more time." << endl
77+
<< endl;
6878
system("pause");
6979
break;
7080
}
7181

7282
} while (num != '0');
7383
}
74-
else cout << "\n Wrong name or password\n";
84+
else
85+
cout << "\n Wrong name or password\n";
7586
break;
7687
case 50:
7788
system("CLS");
7889
cout << "\n Input your name without space";
7990
cout << "\n ";
8091
cin >> data.name;
81-
cout << "\n Input yuor password without space";
92+
cout << "\n Input your password without space";
8293
cout << "\n ";
8394
cin >> data.password;
8495
data.balance = 0;
@@ -88,19 +99,11 @@ void MainMenu() {
8899
case 51:
89100
break;
90101
default:
91-
cout << "\n There is no such ssection";
102+
cout << "\n There is no such section";
92103
cout << "\n Please try one more time";
93104
break;
94105
}
95106
} while (choice != 51);
96107

97-
98-
99-
100-
101108
cout << "\n ";
102109
}
103-
104-
105-
106-

0 commit comments

Comments
 (0)