Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main () {
- int ip = -1;
- int tot = 0;
- int num = 0;
- int outstanding_scores = 0;
- int satisfactory_scores = 0;
- int unsatisfactory_scores= 0;
- char answer = 'Y';
- //bool valid = true;
- while ((answer=='Y') || (answer=='y')){
- cout << "Input score:";
- cin >> ip;
- if (cin.good()) {
- if (ip >= 0) {
- if((ip>=90)&&(ip<=100)){
- outstanding_scores++;
- cout << "Outstanding score! ";
- }
- else if((ip>=60)&&(ip<=89)){
- satisfactory_scores++;
- cout << "Satisfactory score. ";
- }
- else if(ip<=59){
- unsatisfactory_scores++;
- cout << "Unsatisfactory score. ";
- }
- else {
- cout << "Invalid score. ";
- }
- tot = tot + ip;
- num++;
- cout << "Would you like to enter another exam?";
- cin >> answer;
- }
- else {
- cout << "Integer is not greater than zero. ";
- }
- }
- else {
- cout << "You did not enter an Integer. ";
- }
- }
- cout << "The average scores of these exams are " << tot/num;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement