I need help with some homework I have for a programming class.
I am supposed to make a bank account program that's able to have the default value of money set to 1000 and you should be able to deposit and withdraw money from it and check your current amount of money and it shouldn't be possible to withdraw more money than what exists on your bank account. I am supposed to do it with the help of Switch-case sets but I will come to that later
I have started building my program but I ran into a problem really, really early :<
Here's my program;
#include <iostream>
usingnamespace std;
int main()
{
// menu
char menu;
int value;
int money = 1000;
cout << "MENU" << endl << "1. Deposit" << endl << "2. Withdraw" << endl << "3. Show proceeds" << endl;
cin >> menu;
// Deposit
if (menu = '1') {
cout << "Chose amount of money you want to deposit :";
cin >> value;
money = money+value;
cout << "You now have " << money << "$ in your bank account";
}
// Withdraw
elseif (menu = '2') {
cout << "Chose amount of money you want to withdraw :";
cin >> value;
money = money - value;
cout << "You withdrew " << value << "$. You now have " << money << "$ on your bank account";
}
// Show proceeds
elseif (menu = '3') {
}
return 0;
}
The problem is that the deposit menu works well but at the withdraw menu you are supposed to select the amount of money you want to withdraw from your account. Though my program is depositing the amount of money you choose instead of withdrawing it.