-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
100 lines (78 loc) · 2.63 KB
/
main.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
#include <iostream>
#include <sqlite3.h>
using namespace std;
// Create database table
void setup_database()
{
return 0;
}
int main() {
cout << "----------------------THE BANK----------------------" << endl;
double balance = 0.0; // Store user's balance
int option;
while (true) {
cout << "\n1. Open bank account" << endl;
cout << "2. Close bank account" << endl;
cout << "3. Deposit" << endl;
cout << "4. Withdraw" << endl;
cout << "5. Balance" << endl;
cout << "6. Get all open accounts" << endl;
cout << "7. Get all closed accounts" << endl;
cout << "98. Security Actions" << endl;
cout << "99. Exit" << endl;
cout << "\n[Option]:> ";
cin >> option;
switch (option)
{
case 1:
// Call function to CREATE an account
cout << "\nBank account opened successfully." << endl;
break;
case 2:
// Call function to DELETE an account
cout << "\nBank account closed." << endl;
return 0;
case 3:
{
double depositAmount;
cout << "Enter deposit amount: ";
cin >> depositAmount;
balance += depositAmount;
// call deposit function here
cout << "\nDeposited: $" << depositAmount << endl;
}
break;
case 4:
{
double withdrawAmount;
cout << "Enter withdrawal amount: ";
cin >> withdrawAmount;
if (withdrawAmount <= balance) { // replace with the get function
balance -= withdrawAmount;
cout << "\nWithdrawn: $" << withdrawAmount << endl;
} else {
cout << "I\nnsufficient funds." << endl;
}
}
break;
case 5:
// call the get balance function
cout << "\nCurrent Balance: $" << balance << endl;
break;
case 98:
cout << "\nSecurity Actions are not implemented yet." << endl;
break;
case 99:
cout << "\nExiting the bank system. Goodbye!" << endl;
return 0;
default:
cout << "\nInvalid option. Please try again." << endl;
break;
}
// Wait for user to press enter to continue
cout << "\nPress Enter to continue...";
cin.ignore(); // Ignore the newline left in the input buffer
cin.get(); // Wait for user to press Enter
}
return 0;
}