C/C++ >> student result.cpp...starting frm student 0!!!Trouble!
Posted by Sheph on 19:36:00 04-02-2003
Hi There..The problem is that it's starting student 0.... Plz help!


#include

int index;
int iNumStudents ;
float fStudentMark;
float fMax = -1;
float fMin =-1;
float fSum = 0;
float fAvg = 0;

int main() {
cout ";
cin -->--> iNumStudents;

for (index; index ";
cin -->--> fStudentMark;

if (fMax fMax) {
fMax = fStudentMark;
}

if (fStudentMark I know the answer to that one . Good gravy. [addsig]
Posted by Sonarman on 09:49:00 04-04-2003
Hi Sheph! Here's a hint: whenever you create a variable that you plan to use in a loop, always remember to set the variable's value before you use it in a loop. So, for this program, you might want to take a look at your index variable.
Posted by Smerdyakov on 10:57:00 04-04-2003
I don't think it was appropriate to say that, Sonarman. (Unless the user community of this web site wants to _encourage_ people to post their broken homework code and be told how to change it to work properly.)
Posted by KaGez on 23:27:00 04-04-2003
if he is going to learn out of it, I absolutely don't see the problem. If you're stuck with maths homework, and ask somebody to help you, it's quite much the same thing, isn't it?
[addsig]
Posted by Smerdyakov on 05:45:00 04-05-2003
That's right, KaGeZ, it is the same thing, and many universities consider both instances of "getting help" to be cheating.