Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. /********************************************
  2. Name: Alexander Diaz
  3. Panther ID: 3840829
  4. Assignment: Homework 2
  5. Write a C++ program to calculate the average
  6. grades of 20 students in a class. Each student
  7. takes 5 exams and the average grade is calculated
  8. as the average of all the 5 exams. The program must
  9. ask the user to input grades for each student, calculate
  10. the average grade and display the output.
  11. ********************************************/
  12. #include <iostream>
  13. #include <math.h>
  14.  
  15. using namespace std;
  16.  
  17. int main()
  18. {
  19.  
  20. float e1, e2, e3, e4, e5;
  21. int student;
  22.  
  23. for (student = 1; student <= 20; student++)
  24.  
  25. {
  26. cout << "Please enter the five exams grades for student" student;
  27. cin >> e1;
  28. cin >> e2;
  29. cin >> e3;
  30. cin >> e4;
  31. cin >> e5;
  32. cout << "Average grade is " (e1 + e2 + e3 + e4 + e5) / 2;
  33.  
  34. }
  35.  
  36. system("pause");
  37. return 0;
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement