forked from Rustam-Z/cpp-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
109 lines (102 loc) · 2.3 KB
/
Copy pathmain.cpp
File metadata and controls
109 lines (102 loc) · 2.3 KB
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
#include "Header.h"
int main()
{
srand(time(0));
::available = rand() % 200000;
MainMenu();
system("color 9E");
system("pause");
return 0;
}
void MainMenu()
{
system("color 9E");
char num;
char choice;
do
{
bool checked = false;
string checkName, checkPassword;
accounts data;
accounts oldData[50];
cout << "\n Choose what you want:";
cout << "\n 1.Sign in";
cout << "\n 2.Registration";
cout << "\n 3.Exit";
cout << "\n ";
choice = _getch();
switch (choice)
{
case 49:
outData(oldData);
system("CLS");
cout << "\n Please enter your name:";
cout << "\n ";
cin >> checkName;
cout << "\n Please enter your password:";
cout << "\n ";
cin >> checkPassword;
for (int i = 0; i < ::increaments; i++)
{
if (oldData[i].name == checkName && oldData[i].password == checkPassword)
{
::accountNum = i;
::balance = oldData[i].balance;
::borrow = oldData[i].borrowed;
checked = true;
}
}
if (checked)
{
do
{
system("CLS");
cout << "\n Hello " << oldData[::accountNum].name << endl;
cout << "\n What would you like to do?" << endl;
cout << "\n 1.Actions with card" << endl;
cout << "\n 2.Check balance" << endl;
cout << "\n 0.Exit" << endl;
num = _getch();
switch (num)
{
case 48:
break;
case 49:
Menu(oldData);
break;
case 50:
CheckBalance();
break;
default:
cout << "\n Error! Section not found. Please try one more time." << endl
<< endl;
system("pause");
break;
}
} while (num != '0');
}
else
cout << "\n Wrong name or password\n";
break;
case 50:
system("CLS");
cout << "\n Input your name without space";
cout << "\n ";
cin >> data.name;
cout << "\n Input your password without space";
cout << "\n ";
cin >> data.password;
data.balance = 0;
data.borrowed = 0;
inputNewData(data);
break;
case 51:
break;
default:
cout << "\n There is no such section";
cout << "\n Please try one more time";
break;
}
} while (choice != 51);
cout << "\n ";
}