Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CLASS_GRADE(STUDENT X[50], int num)
- {
- char grade(float total);
- float total, avg = 0, curve_factor;
- //Finding Class Total Score
- for (int j = 0; j < num; j++)
- avg += X[j].Q + X[j].R + X[j].T + X[j].Fin;
- //Finding Class Average
- avg /= 52;
- //Finding curve factor & changing average
- if (avg < 70)
- {
- curve_factor = 70 / avg;
- printf("The class average is: %.2f\n", avg);
- printf("Since the class average is: %.2f, the grades were curved by %.2f\n", avg, curve_factor);
- avg = 70;
- }
- //Calculating score & grade
- for (int i = 0; i < num; i++)
- {
- total = (0.2 * X[i].Q) + (0.2 * X[i].R) + (0.3 * X[i].T) + (0.3 * X[i].Fin);
- total *= curve_factor;
- X[i].G = grade(total);
- //Printing Names Left-Wise
- printf("%-20s", X[i].name);
- //Printing Score and Grade
- printf("%.2f", total);
- printf(" %c\n", X[i].G);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement