Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. const int students = 10;
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int arr[students], i = 0, count = 0;
  9.     char str[students], ch;
  10.  
  11.     do
  12.     {
  13.         cout << "Please Enter Grade of student " << i+1 << ": ";
  14.         cin >> ch;
  15.         if(ch=='A'||ch=='B'||ch=='a'||ch=='b')
  16.         {
  17.             str[i]=ch;
  18.             if(ch == 'A'|| ch == 'a')
  19.                 count++;
  20.             i++;
  21.         }
  22.         else
  23.             cout << "Please Enter 'A' or 'B' only" << endl;
  24.     } while(i < 10);
  25.     cout << "Total No. of A Grades: " << count << endl;
  26.     if(count <= 2)
  27.         cout << "\"Your class is Poor!\"" << endl;
  28.     else if(count <= 7)
  29.         cout << "\"Your class is Good!\"" << endl;
  30.     else if(count >= 8)
  31.         cout << "\"Your class is Brilliant!\"" << endl;
  32.     cout << "Press any key to continue... ";
  33.     cin.ignore();
  34.     cin.get();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement