// Determines user's grade. Grades are Pass or Fail \ // demonstrates the importance of correct order of arguments // Walt Savitch // 2/10/00 #include using namespace std; const int MIN_SCORE=75; // computes grade // Returns 'P' for passing, and 'F' for failing. char grade(int); int main() { int score; // score got char letter_grade; // grade assigned cout << "Enter your score: "; cin >> score; // calling the function that computes the grade letter_grade = grade(score); cout << "You received a score of " << score << endl; if (letter_grade == 'P') cout << "You Passed. Congratulations!\n"; else cout << "Sorry. You failed.\n"; cout << letter_grade << " will be entered in your record.\n"; } // computes the grade // received - score received char grade(int received) { char result; if (received >= MIN_SCORE) result='P'; else result='F'; return result; }