Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. void CLASS_GRADE(STUDENT X[50], int num)
  2. {
  3. char grade(float total);
  4. float total, avg = 0, curve_factor;
  5.  
  6. //Finding Class Total Score
  7. for (int j = 0; j < num; j++)
  8. avg += X[j].Q + X[j].R + X[j].T + X[j].Fin;
  9.  
  10. //Finding Class Average
  11. avg /= 52;
  12.  
  13. //Finding curve factor & changing average
  14. if (avg < 70)
  15. {
  16. curve_factor = 70 / avg;
  17. printf("The class average is: %.2f\n", avg);
  18. printf("Since the class average is: %.2f, the grades were curved by %.2f\n", avg, curve_factor);
  19. avg = 70;
  20. }
  21.  
  22. //Calculating score & grade
  23. for (int i = 0; i < num; i++)
  24. {
  25. total = (0.2 * X[i].Q) + (0.2 * X[i].R) + (0.3 * X[i].T) + (0.3 * X[i].Fin);
  26. total *= curve_factor;
  27. X[i].G = grade(total);
  28.  
  29. //Printing Names Left-Wise
  30. printf("%-20s", X[i].name);
  31.  
  32. //Printing Score and Grade
  33. printf("%.2f", total);
  34. printf(" %c\n", X[i].G);
  35. }
  36.  
  37. return;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement