1
1
#include " Header.h"
2
2
3
- int main () {
3
+ int main ()
4
+ {
4
5
srand (time (0 ));
5
6
::available = rand () % 200000 ;
6
7
MainMenu ();
@@ -10,12 +11,14 @@ int main() {
10
11
return 0 ;
11
12
}
12
13
13
- void MainMenu () {
14
+ void MainMenu ()
15
+ {
14
16
system (" color 9E" );
15
17
char num;
16
18
char choice;
17
- do {
18
-
19
+ do
20
+ {
21
+
19
22
bool checked = false ;
20
23
string checkName, checkPassword;
21
24
accounts data;
@@ -37,48 +40,56 @@ void MainMenu() {
37
40
cout << " \n Please enter your password:" ;
38
41
cout << " \n " ;
39
42
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
+ {
43
48
::accountNum = i;
44
49
::balance = oldData[i].balance ;
45
50
::borrow = oldData[i].borrowed ;
46
51
checked = true ;
47
52
}
48
-
49
53
}
50
- if (checked) {
51
- do {
54
+ if (checked)
55
+ {
56
+ do
57
+ {
52
58
system (" CLS" );
53
- cout << " \n Hello " << oldData[::accountNum].name << endl;
59
+ cout << " \n Hello " << oldData[::accountNum].name << endl;
54
60
cout << " \n What would you like to do?" << endl;
55
61
cout << " \n 1.Actions with card" << endl;
56
62
cout << " \n 2.Check balance" << endl;
57
63
cout << " \n 0.Exit" << endl;
58
64
num = _getch ();
59
- switch (num) {
65
+ switch (num)
66
+ {
60
67
case 48 :
61
68
break ;
62
- case 49 : Menu (oldData);
69
+ case 49 :
70
+ Menu (oldData);
63
71
break ;
64
- case 50 : CheckBalance ();
72
+ case 50 :
73
+ CheckBalance ();
65
74
break ;
66
75
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;
68
78
system (" pause" );
69
79
break ;
70
80
}
71
81
72
82
} while (num != ' 0' );
73
83
}
74
- else cout << " \n Wrong name or password\n " ;
84
+ else
85
+ cout << " \n Wrong name or password\n " ;
75
86
break ;
76
87
case 50 :
77
88
system (" CLS" );
78
89
cout << " \n Input your name without space" ;
79
90
cout << " \n " ;
80
91
cin >> data.name ;
81
- cout << " \n Input yuor password without space" ;
92
+ cout << " \n Input your password without space" ;
82
93
cout << " \n " ;
83
94
cin >> data.password ;
84
95
data.balance = 0 ;
@@ -88,19 +99,11 @@ void MainMenu() {
88
99
case 51 :
89
100
break ;
90
101
default :
91
- cout << " \n There is no such ssection " ;
102
+ cout << " \n There is no such section " ;
92
103
cout << " \n Please try one more time" ;
93
104
break ;
94
105
}
95
106
} while (choice != 51 );
96
107
97
-
98
-
99
-
100
-
101
108
cout << " \n " ;
102
109
}
103
-
104
-
105
-
106
-
0 commit comments