I have a student stat calculator that i'm working on. My Average function doesn't want to store the average in float Avg. Also not sure how to get my input to accept different amounts of (names + scores)... I have this...for(int i=0; i<17; i++){.. and I tried to switch 17 to Size but this crashes the program.
Michelle 71
Marcie 99
David 42
Rebecca 83
Jonathan 79
Matthew 77
Rose 7
Melanie 75
Kimberly 73
Scott 72
Bradley 74
Drextell 10
Heidi 70
Alan 68
Pearl 13
Jeanne 43
Heber 55
I see... maybe I need to read up on what to initialize to zero. I modified my code with float total to zero. However.... Still not getting the proper result. I should be getting 59 something, but i get 6.06727e-39. So I deduce that an incorrect value is being stored in either Size, total, or Avg. Any thoughts on this?
It's not storing the correct value in total... because I can replace total with the sum which is 1011 and i get the ...? well i get 50.. should get 59.hmm.. i just tried the same thing for Size... set it to 17 then i get 59. all i can be certain of is that Avg is holding the correct values. Also this means that 1011 is being divided by 20. so size is holding 20 places... how can i change my for loop to use Size instead of 20 in my input function?