-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBanking System.cpp
148 lines (121 loc) · 3.37 KB
/
Banking 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
#include <iostream>
#include <string.h>
#include <conio.h>
#include <cstdlib>
using namespace std;
string lines = " ----------------------------- ";
string name;
int amount = 0;
int option;
int a;
void NameMenu()
{
cout << endl << lines << endl;
cout << endl << endl << endl;
cout << " Hello! Please enter your name!" << endl;
cout << endl << endl << endl << lines << endl << endl;
cout << " "; cin >> name;
}
void Menu()
{
cout << endl << endl << lines << endl;
cout << endl; cout << " Hello " << name << "! Select an option:" << endl << endl;
cout << " 1.Recieve funds number" << endl;
cout << " 2.Extract amount" << endl;
cout << " 3.Call a specialist" << endl;
cout << " 4.Exit" << endl;
cout << lines << endl;
cout << endl;
cout << " "; cin >> option;
}
void PleaseWait()
{
cout << endl << endl << lines << endl;
cout << endl << endl << endl;
cout << " Please wait..." << endl;
cout << endl << endl << endl << lines << endl << endl;
amount -= a;
_getch();
system("cls");
}
void Screen1()
{
int max = 20000; srand(time(0));
cout << endl << endl << lines << endl;
cout << endl << endl << endl;
if (amount == 0) {
amount = rand() % max;
cout << " You have " << amount << " funds in your account" << endl;
}
else {
cout << " You have " << amount << " funds in your account" << endl;
}
cout << " Press enter to return to the main screen" << endl << endl << endl << lines << endl << endl;
cin.ignore(INT_MAX, '\n');
cin.ignore();
}
void Screen2_Screen1()
{
int max = 20000; srand(time(0));
cout << endl << endl << lines << endl;
cout << endl << endl << endl;
cout << " Please enter the amount you would want" << endl;
cout << " You currently have ";
if (amount == 0) {
amount = rand() % max;
cout << amount << " dollars.";
}
else {
cout << amount << " dollars.";
}
cout << endl << endl << lines << endl << endl;
cout << " "; cin >> a;
system("cls");
}
void Screen2_Screen2()
{
cout << endl << endl << lines << endl;
cout << endl << endl << endl;
cout << " Here are the " << a << " dollars you requested." << endl;
cout << " Currently you have " << amount << " dollars left." << endl << " Press enter to continue." << endl << lines << endl << endl;
cin.ignore(INT_MAX, '\n');
cin.ignore();
}
void Screen3()
{
cout << endl << endl << lines << endl;
cout << endl << endl << endl;
cout << " Calling someone to help. Please wait..." << endl;
cout << endl << endl << endl << lines << endl << endl;
_getch();
system("cls");
}
int main()
{
int m = 0;
NameMenu();
system("cls");
do {
Menu();
system("cls");
if (option == 1) {
Screen1();
system("cls");
}
else if (option == 2) {
Screen2_Screen1();
PleaseWait();
Screen2_Screen2();
system("cls");
}
else {
if (option == 3) {
Screen3();
}
else {
m += 1;
}
}
} while (m < 1);
return 0;
}