i need to do a program that simulates a bank account without using classes and objects, but using functions etc
the program has to do all a bank account does deposit, withdraw etc
can someone help? :)
#include <iostream>
usingnamespace std;
int cashIn;
int cashInBank;
int main() {
int cash = 100; //you can change this cuz why not
while (true == true) {
cout << "Welcome to the Espada City Bank! What would you like to do? Deposit(1) Withdraw(2) Never-Mind(3)""\n";
int interaction;
cin >> interaction;
if (interaction == 1) {
cout << "How much money would you like to deposit? You currently have " << cash << "$.""\n";
cin >> cashIn;
if (cashIn > cash) {
cout << "You do not have that much money!""\n";
continue;
}
elseif (cashIn <= cash) {
cash = cash - cashIn;
cashInBank = cashInBank + cashIn;
cashIn = 0;
cout << "You currently have " << cashInBank << "$ In the bank." << "\n";
continue;
}
}
elseif (interaction == 2) {
cout << "How much money would you like to withdraw? You currently have " << cashInBank << "$ In the bank.""\n";
int withdraw;
cin >> withdraw;
if (withdraw > cashInBank) {
cout << "You do not have that much cash in the bank!""\n";
continue;
}
else {
cash = cash + withdraw;
cashInBank = cashInBank - withdraw;
cout << "Transaction Succsesful.""\n";
continue;
}
}
else {
cout << "Come again soon!""\n";
return 0;
}
}
}