#include <iostream>
#include <conio.h>
using namespace std;
int main() {
int grade;
int sum = 0;
int count = 0;
cout << "\n\n\tAverage Grade Checker in C++ with Remarks\n\n";
cout << "\n\tEnter grades (enter -1 to finish):\n";
while (true) {
cout << "\n\tEnter grade: ";
cin >> grade;
if (grade == -1) {
break;
}
sum += grade;
count++;
}
if (count == 0) {
cout << "\nNo grades entered. Exiting...\n";
return 0;
}
double average = static_cast<double>(sum) / count;
cout << "\n\tAverage grade: " << average << "\n\n";
// Determine the corresponding grade category
if (average == 100) {
cout << "\n\tExcellent\n";
} else if (average >= 95 && average <= 99) {
cout << "\n\tVery Satisfactory\n";
} else if (average >= 90 && average <= 94) {
cout << "\n\tSatisfactory\n";
} else if (average >= 85 && average <= 89) {
cout << "\n\tOutstanding\n";
} else if (average >= 80 && average <= 84) {
cout << "\n\tGood\n";
} else if (average >= 75 && average <= 79) {
cout << "\n\tPass\n";
} else {
cout << "\n\tFail\n";
}
cout << "\n\n";
cout << "\tEnd of Program\n\n";
getche();
}
Post Views: 951