-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathATM_Simulator.cpp
More file actions
56 lines (54 loc) · 1.85 KB
/
ATM_Simulator.cpp
File metadata and controls
56 lines (54 loc) · 1.85 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
#include <iostream>
using namespace std;
int main() {
//ATM SIMULATOR BY ABEER
int bal=0;
cout << "░▄▄▄▄░" << endl;
cout << "▀▀▄██►" << endl;
cout << "▀▀███►" << endl;
cout << "░▀███►░█►" << endl;
cout << "▒▄████▀▀" << endl;
while (true) {
cout << "\n\nWhat would you like to do? enter ONLY NUMBER corresponding to the action!!\n 1 --> Withdraw \n 2 --> Deposit\n\n >>>";
int action;
cin >> action;
switch (action) {
case 1:
if (bal==0) {
cout << "You have no money, please deposit before withdrawing";
continue;
}
else {
cout << "You have " << bal << "money" << endl;
cout << "How much money would you like to withdraw?\n>>>";
int amount;
cin >> amount;
bal -= amount;
cout << "You have " << bal << " money left" << endl;
}
case 2:
if (bal==0) {
cout << "You have" << bal << " money" << endl;
cout << "How much money would you like to deposit?\n>>>";
int amount;
cin >> amount;
bal += amount;
cout << "You have " << bal << " money left" << endl;
}
}
cout << "If you want to continue, input 1, if you want to terminate this simulator, input 2.\n>>>";
int terminator;
cin >> terminator;
if (terminator==1) {
continue;
}
else if (terminator==2) {
break;
}
else {
cout<<"Invalid Input" << endl;
continue;
}
}
return 0;
}