Lexington High School Mathematics Math Dept. Front Page  | Student Links  | Family Links 
Introduction to C++, Kevin Kelly Kelly Front Page  | C++ Course Guide | C++ Assignments | C++ Info

Assignment 13: Letter grades

due Monday 3/18

Some teachers give letter grades using this traditional numerical scale:

90-10080-8970-7960-69below 60
ABCDF
Write a program that inputs a student's numerical grade and outputs the appropriate letter grade. Also, if the grade is 100, in addition to the letter grade, also output a message congratulating the student for a perfect paper.

Use the else if construction to avoid unnecessary comparisons. For example, if you've already determined that a score is in the A range, there's no need to check whether it is in the B range.


Extensions

For 10 pts.: Write a program that inputs a set of student last names and number grades from a data file, then prints a list of names and letter grades. (For help with file input, try this tutorial (particularly the section titled "Text mode files"), or see pp. 46-47 and 134-137 in the textbook.)