// Begin Psuedocode Design Author: Liam Smith // Date: 02/03/06 // Version: Assignment 3 Pseudocode Design // Lecturer: Digby Barrett & Kim Ng // Objective: Read in grades for 10 students. // Make sure each grade is between 0 and 100. // (i.e. Validate the input) // // Print the average of all students who passed, // and theaverage of all students who failed. for student = less10 do write("Enter grade") read(grade) end do while(grade = less0 or more100) if(grade = less50) fail=fail+grade failav+1 end if else if(grade = more50) pass=pass+grade passav+1 end if end for pass=pass/passav fail=fail/failav write("Number of fails = [failav]") write("Average fail grade = [fail]") write("Number of passes = [passav]") write("Average pass grade = [pass]") // End Psuedocode // Begin CPP Code // Author: Liam Smith // Date: 02/03/06 // Version: 1.1 // Lecturer: Digby Barrett & Kim Ng // Objective: Read in grades for 10 students. // Make sure each grade is between 0 and 100. // (i.e. Validate the input) // // Print the average of all students who passed, and the // average of all students who failed. #include int main() { // Identifiers and their values. int grade=0, student=1, pass=0, fail=0, passav=0, failav=0; // "For" loop continues while the student value is less than or equal to 10, each // time it loops it adds 1 to the student value. for (student;student<=10;student++) { do { // "cout" display's a promt or a message, "cin" allows the user to input data. cout<<"\n Enter a grade for student "<>grade; } while (grade<0 || grade>100); // "if" gives a condition, if the condition is true an action is performed and // the "for" loop is repeated, with a "cout" promt. if (grade<50) {fail=fail+grade; failav++; } // "else" tests the next "if" condition, only if the previous "if" was false. else if (grade>=50) {pass=pass+grade; passav++; } } pass=pass/passav; fail=fail/failav; cout<<"\n ------------------------------------------"; cout<<"\n Number of students who failed ="<