SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. int main(){
  4.    
  5.     int input = 0;
  6.     int gradeCount = 0;
  7.     int gradeSum = 0;
  8.    
  9.     while (input >= 0) {
  10.        
  11.         std::cout << "Enter grade (-1 finish)\n";
  12.         std::cin >> input;
  13.         if (input > 0) {
  14.             gradeCount++;
  15.             gradeSum+=input;
  16.             std::cout << "Grade " << input << "% added\n";
  17.         }  
  18.     }
  19.    
  20.     std::cout << "Average GPA is " << gradeSum / gradeCount;
  21.      
  22.     return 0;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top