The user input name, id, and a grade for a final.
I would like to know how to find the total of student who passed the class and total who failed it.
I started with that but not sure what to do after
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int findminmax(Student tabStudent[], int size)
{
int max = 0;
int min = 0;
min = tabStudent[0].Final;
max = tabStudent[0].Final;
for (int i = 1; i < size; i++)
{
if (tabStudent[i].Final>= 60)
max = tabStudent[i].Final;
if (tabStudent[i].Final< 60)
min = tabStudent[i].Final;
}
}
int no_of_students_gradeA=0
int no_of_students_gradeB=0
for each student
if student.grade == A
no_of_students_gradeA ++
if student.grade == B
no_of_students_gradeB ++
etc
next student
You can use a switch, if cascade and other methods to separate and control grade count
1. You can't have two returns unfortunately.
2. Also, your for loop is missing a brace to close it off.
3. To just have one return value, which is all you can have, then take advantage of the fact that the number failed is the no. of students minus the no. who passed. And the no. of students in total is no. passed plus no failed, if you get what I mean.