iso forbids comparison between pointer and function

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!

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
 #include <cstdlib>
#include <iostream>

using namespace 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;
}
replace your code with

1
2
3
4
5
6
7
for (int i = 0; i < 5; i = i + 1)
	{
		if (balance[i] <= minBal) 
		cout << balance[i] - 10<< endl;
		else
		cout << balance[i] << endl;
	}
Awesome, Thank you so much!
Topic archived. No new replies allowed.