Advertisement
wigllytest

Untitled

Aug 10th, 2020
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. int n;
  9. cin >> n;
  10. string input;
  11. //cin >> input;
  12.  
  13. cin.ignore();
  14. getline(cin, input);
  15.  
  16. int counter = 0;
  17. double gradeSum = 0;
  18. double average = 0;
  19. int countGrade = 0;
  20.  
  21. cout.setf(ios::fixed);
  22. cout.precision(2);
  23.  
  24.  
  25. while (input != "Finish")
  26. {
  27.  
  28. while (counter < n)
  29. {
  30. countGrade++;
  31. counter++;
  32. double grade;
  33. cin >> grade;
  34. gradeSum += grade;
  35. average += grade;
  36. }
  37. counter = 0;
  38. //average += gradeSum/;
  39. cout << input << " - " << gradeSum / n << "." << endl;
  40. gradeSum = 0;
  41. cin.ignore();
  42. getline(cin, input);
  43. }
  44.  
  45. cout << "Student's final assessment is " << average/ countGrade << ".";
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement