Question: How do I fix this program to actually display what it needs to display. It's a C + + program and I don't know why

How do I fix this program to actually display what it needs to display. It's a C++ program and I don't know why it doesn't work.
#include
using namespace std;
//declarations
void checkBalance(float balance);
float depositMoney(float balance);
float withdrawMoney(float balance);
int main()
{
float balance =0.0;
int choice;
char another_Transaction;
int accountBalances[10]{1000,1000,1000,1000,1000,1000,1000,1000,1000,1000};
cout << "Welcome to the Simple ATM System!
";
do {
cout <<"
====== ATM Menu ======
";
cout <<"1. Check Balance
";
cout <<"2. Deposit Money
";
cout <<"3. Withdraw Money
";
cout <<"4. Exit
";
cout << "Enter your choice: ";
cin >> choice;
//Process the user's input
switch (choice){
case 1:
checkBalance(balance);
break;
case 2:
balance = depositMoney(balance);
break;
case 3:
balance = withdrawMoney(balance);
break;
case 4:
cout << "Thank you for using the ATM. Goodbye!
";
return 0;
default:
cout << "Invalid choice! Please select a valid option.
";
}
cout <<"
Do you want to perform another transaction? (y/n): ";
cin >>another_Transaction;
} while (another_Transaction =='y'|| another_Transaction =='Y');
cout << "Thank you for using the ATM. Goodbye!
";
return 0;
}
//check balance
void checkBalance(float balance)
{
cout << "Your current balance is:
", balance;
}
//deposit money
float depositMoney(float balance)
{
float amount;
cout << "Enter the amount to deposit: ";
cin >> amount;
if (amount >0){
balance += amount;
cout << "Successfully deposited . Your new balance is:
", amount, balance;
}
else {
cout << "Invalid amount. Please try again.
";
}
return balance;
}
//withdraw money
float withdrawMoney(float balance)
{
float amount;
cout << "Enter the amount to withdraw: ";
cin >> amount;
if (amount >0 && amount <= balance)
{
balance -= amount;
cout << "Successfully withdrew %.2f. Your new balance is:
", amount, balance;
}
else if (amount > balance)
{
cout << "Insufficient balance.Your current balance is :
", balance;
}
else
{
cout << "Invalid amount. Please try again.
";
}
return balance;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!