View Single Post
Join Date: Nov 2008
Posts: 89
Reputation: brechtjah is an unknown quantity at this point 
Solved Threads: 9
brechtjah's Avatar
brechtjah brechtjah is offline Offline
Junior Poster in Training

Re: Homework Function Compile Errors

 
0
  #2
Nov 20th, 2008
Most of the errors you get are typing errors I presume.
For instance, a lot of times you use max or min, where you're giving min or maxloc as argument to the function.
Also some variables are just not declared in a function, remember that each function has it's own variables if they are not declared globally or given as arguments.

EDIT:
a second look at your code tells me that some errors you are having are also forgetting { or not knowing the syntaxis.

Also, in your main function you have this:
  1. int main() {
  2. int maxloc, minloc, range, bottom = 0, top = 0;
  3. double votes [50], min=votes[minloc], max=votes[maxloc];
  4. }

The problem with this code is that maxloc and minloc are not initialised, which means they can be any value. You have to give them a startvalue, (I don't know how your program works, just corrected some errors quickly)

Hopefully this can help you further...
Last edited by brechtjah; Nov 20th, 2008 at 8:15 pm.
Reply With Quote