Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int students = 0;
- double average = 0;
- int currentmark = 0;
- int totalmark = 0;
- int highestmark = 0;
- int lowestmark = 1000;
- int aS = 0;
- int bS = 0;
- int cS = 0;
- int fS = 0;
- cout << "Enter the amount of students: ";
- cin >> students;
- cout << "\n\n\n";
- for(int i = 1; i <= students; i++) {
- cout << "Enter student #" << i << " mark: ";
- cin >> currentmark;
- if(currentmark > highestmark) {
- highestmark = currentmark;
- }
- if(currentmark < lowestmark) {
- lowestmark = currentmark;
- }
- totalmark += currentmark;
- if(currentmark <= 100 && currentmark >= 80) {
- aS++;
- } else if(currentmark <= 79 && currentmark >= 70) {
- bS++;
- } else if(currentmark <= 59 && currentmark >= 50) {
- cS++;
- } else if(currentmark < 50) {
- fS++;
- } else if(currentmark < 0 || currentmark > 100) {
- cout << "\nInvalid mark!";
- }
- }
- average = totalmark / students;
- cout << "-----------------------\n";
- cout << "CLASS REPORT:\n";
- cout << "-----------------------\n\n";
- cout << "Number of Students: " << students << "\n";
- cout << "Class Average: " << average << "\n";
- cout << "Highest Mark: " << highestmark << "\n";
- cout << "Lowest Mark: " << lowestmark << "\n";
- cout << "\nNumber of A's: " << aS << "\n";
- cout << "Number of B's: " << bS << "\n";
- cout << "Number of C's: " << cS << "\n";
- cout << "Number of F's: " << fS << "\n";
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement