Forgive something so remedial but I'm completely stuck. It keeps giving me the "Local definitions are illegal" error referencing the findLowest function in the code below. This is for a program for class that will have me getting 5 scores from the user, dropping the lowest, and averaging the rest. If you guys can help me get unstuck so I can finish the rest of the program I would be very grateful. Also does the rest of it make any sense? Is my logic correct? I'll have another function that will find the average of the 4 elements of score that are not equal to "lowest" after the minimum value is found by the program. I am a total noob I know but if anyone could help I'd really appreciate it.
Either remove the { on line 29 or add a } to the end of it. You don't currently have a terminating brace for the definition of getScore so the compiler thinks you're trying to define findLowest within the getScore function.
Generally, function declarations are made at global scope (outside of a function.) Line 6 should be void getScore(int&); to match the actual definition.
An improvement would be to put the gathering of the input into a for loop - what if you had do this for 100 items?
Also, reorganise the findLowest function so it takes the array as an argument rather all it's items individually - again what if there 100 items?
To avoid mismatched braces when using an ordinary text editor (not one that is part of an IDE), get into the habit of typing the closing brace (or any other thing that comes in pairs) immediately after the opening one, as in :
if(){}
Then go back and fill in the rest. When doing a class or struct or anything else that requires a semicolon after the closing brace, do this first also.
I did this for about 20 years, then started using an IDE that automatically did closing braces etc. So then I had to unlearn my somewhat pedantic behaviour .....