Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const int students = 10;
- using namespace std;
- int main()
- {
- int arr[students], i = 0, count = 0;
- char str[students], ch;
- do
- {
- cout << "Please Enter Grade of student " << i+1 << ": ";
- cin >> ch;
- if(ch=='A'||ch=='B'||ch=='a'||ch=='b')
- {
- str[i]=ch;
- if(ch == 'A'|| ch == 'a')
- count++;
- i++;
- }
- else
- cout << "Please Enter 'A' or 'B' only" << endl;
- } while(i < 10);
- cout << "Total No. of A Grades: " << count << endl;
- if(count <= 2)
- cout << "\"Your class is Poor!\"" << endl;
- else if(count <= 7)
- cout << "\"Your class is Good!\"" << endl;
- else if(count >= 8)
- cout << "\"Your class is Brilliant!\"" << endl;
- cout << "Press any key to continue... ";
- cin.ignore();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement