I've searched and found several threads on this topic but none have seemed to solve my problem :/
i'm trying to display the balances of accounts 500 and below after a $10 fee is added using an if else statement. I know there is probably a better way than using if else, but im kind of lost. I'd really appreciate any help! thanks!
#include <cstdlib>
#include <iostream>
usingnamespace std;
int main()
{
int balance[5] = {0, 0, 0, 0, 0};
int sum = 0;
int minBal = 500;
cout <<"you will be asked to ender the balance of 5 savings accounts."<< endl;
for (int i=0; i<5; i=i+1)
{
cout << "Enter balance of an account: ";
cin >> balance[i];
}
cout << endl;
cout << "Balances Entered:"<< endl;
for (int i = 0; i < 5; i = i + 1)
cout << balance[i] << endl;
for (int i=0; i<5; i=i+1)
{
sum = sum + balance[i];
}
cout << "The sum of all 5 scores: " << sum << endl;
cout << endl;
cout << "Apply $10 fee for all accounts with balance below $500. "<< endl;
cout << "New balances:"<< endl;
for (int i = 0; i < 5; i = i + 1)
{
if (balance <= minBal)
cout << balance - 10<< endl;
else
cout << balance << endl;
}
system("pause");
return 0;
}