Hi here is the problem, Write a program to do the following. Ask the user to enter the balance of 5 saving accounts. Store the data in an array. Then do the following:
(a) Display the account balances entered by the user.
(b) Calculate and display the total of the 5 accounts.
(c) Examine the account balances. If the balance of an account is below $500, charge a $10 fee to the account. Display all balances again. The following is an example.
Im getting lots of errors with my code, please help.
Line 20,22: You declared balance as an array at line 7. Here you're trying to use balance as a simple int. Your instructions say to examinne each balance. This would imply a loop.
Note that balance is an array of ints. I don't know what currency you're assuming, but if you want to track fractional amounts (such as dollars and cents), you should consider using a array of doubles.
I have this code and now im getting an error of the following: E:\CIS 115\Lab23P2.cpp In function 'int main()':
[Error] name lookup of 'i' changed for ISO 'for' scoping [-fpermissive]
[Note] (if you use '-fpermissive' G++ will accept your code)
Line 18: i has gone out of scope at line 13. You want to get the balance of the 5 accounts, so you need a for loop here. This is the cause of the error you're getting.
lines 10-13 are not needed since you initialized the array to zeroes at line 7.
Line 8: sum should be a double.
Line 20: You never add the 5 balances to sum. sum will print as 0.