-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (45 loc) · 1.42 KB
/
main.cpp
File metadata and controls
54 lines (45 loc) · 1.42 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
#include <iostream>
using namespace std;
int main() {
int choice;
double balance = 1000.0;
double amount;
{
cout << "\n===== ATM MENU =====\n";
cout << "1. check Balance\n";
cout << "2. Deposit Money\n";
cout << "3. Withdraw Money\n";
cout << "4. Exit\n";
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
cout << "your balance is: GHS " << balance << endl;
break;
case 2:
cout << "Enter amount to deposit: ";
cin >> amount;
if (amount > 0) {
balance += amount;
cout << "Deposit successful.\n";
} else {
cout << "Invalid amount.\n";
}
break;
case 3:
cout << "Enter amount to withdraw: ";
cin >> amount;
if (amount > 0 && amount <= balance) {
balance -= amount;
cout << "please your cash.\n";
}
break;
case 4:
cout << "Thank you for using the ATM. Goodbye!\n";
break;
default:
cout << "Invalid choice. Try again.\n";
}
} while ('choice' != 4);
return 0;
}