// This grading program illustrates the need for arrays. // References: "Writing Messages to Your Screen." // "Programs Store Information in Varables" // "Teaching Your Program to Make Decisions" #include void main(void) { float grade_0, grade_1, grade_2, grade_3, grade_4, grade_5, grade_6; // store the grades grade_0 = 10; grade_1 = 7; grade_2 = 9; grade_3 = 3; grade_4 = 8; grade_5 = 7; grade_6 = 8; // see what are the good students cout << "Student 0 has grade " << setw(2) << grade_0 << "."; if (grade_0 > 7) cout << " Good work!"; cout << endl; cout << "Student 1 has grade " << setw(2) << grade_1 << "."; if (grade_1 > 7) cout << " Good work!"; cout << endl; cout << "Student 2 has grade " << setw(2) << grade_2 << "."; if (grade_2 > 7) cout << " Good work!"; cout << endl; cout << "Student 3 has grade " << setw(2) << grade_3 << "."; if (grade_3 > 7) cout << " Good work!"; cout << endl; cout << "Student 4 has grade " << setw(2) << grade_4 << "."; if (grade_4 > 7) cout << " Good work!"; cout << endl; cout << "Student 5 has grade " << setw(2) << grade_5 << "."; if (grade_5 > 7) cout << " Good work!"; cout << endl; cout << "Student 6 has grade " << setw(2) << grade_6 << "."; if (grade_6 > 7) cout << " Good work!"; cout << endl; // MESSY // HARD TO READ // ERROR PRONE // LIMITED TO A FEW STUDENTS (CERTAINLY NOT 60). // MAJOR MODIFICATIONS IF THE NUMBER OF STUDENTS CHANGES }