Thread: array hlp
View Single Post
  #3 (permalink)  
Old January 22nd, 2007, 09:24 AM
Geo121 Geo121 is offline
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

Your problem is not the starting of the for loop but it is the ending of the for loop

in your for loop it is correct that you start at one and if you wanted the begining of the array you would start at zero however at the end you state less than five which would mean it stops at four your array however is assigned 4 values that would be grades[0-3] which means you must state that the loop stops at less than four so that the unnassigned variable isnt used thats why your average is all messed up

~ Geo

~ Don't take life too seriously, you'll never get out alive!
Reply With Quote