I need help with a while loop program

We have an input file with an unknown number of records. The content of the records are studName (string), studId (integer) and three float exams (exam1, exam2, and exam3). The valid range of data is 1111  studId  9999 and 0.00  exam  100.00. For valid data, determine whether the student has passed or failed or top the course (97.00 > avg of exams  75.00 will pass the course & avg of exams  97.00 will get top rank.) For invalid data, print “~~ Invalid Data ~~” message. At the end, find mean of all exam averages. See input and output sample:

Input file sample1:
Lewis,Rose 1111 75 80 70
Weber,Mark 7821 70 69 69
Runer,Jon 9102 97 97 97
Sooner,Ali 8888 -1 0 100

Output file sample1:
*~~< Stud Exam Report >~~*
Name Stud Id Exam1 Exam2 Exam3 AVG of Exams Passed /Failed
Lewis,Rose 1111 75.00 80.00 70.00 75.00 PASSED
Weber,Mark 7821 70.00 69.00 69.00 69.33 FAILED
Runer,Jon 9102 97.00 97.00 97.00 97.00 TOP
Sooner,Ali 8888 -1 0.00 100.00 ~~ Invalid data ~~~~~~~~~~~~~~~~~

Mean of all AVG = 80.44

Invalid data: %25.00
Valid data: %75.00

Num Of Passed: 1
Num Of Failed: 1
Num Of Top: 1
*< end >*

Input file sample2:
Lewis,Rose 1110 75.00 80 70

Output file sample2:
*~~< Stud Exam Report >~~*
Name Stud Id Exam1 Exam2 Exam3 AVG of Exams Passed /Failed
Lewis,Rose 1110 75.00 80.00 70.00 ~~ Invalid data ~~~~~~~~~~~~~~~~~

*~ No valid data! No mean of all AVG!

Invalid data: %100.00
Valid data: %0.00

*~ No valid data no number of Passed & Failed!
*< end >*
closed account (48T7M4Gy)
int main()
{
return 0;
}

Your move. :)
Start programming sir. :)

We will check if something's wrong. :)
Topic archived. No new replies allowed.