Advertisement
Guest User

websta ptr

a guest
Oct 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. //find above average GPA of Webster preps
  7. const int SIZE = 10;
  8. double grades[SIZE];
  9. string names[SIZE];
  10.  
  11. double total = 0;
  12. for (int i = 0; i < SIZE; i++) {
  13. cin >> grades[i]
  14. >> names[i];
  15. total += grades[i];
  16. }
  17. double average = total / SIZE;
  18.  
  19. //outputting all above average GPAs
  20. for (int i = 0; i < SIZE; i++) {
  21. if (grades[i] > average) {
  22. cout << "Above average GPAs out of the Webster preps:" << endl;
  23. cout << names[i] << endl;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement