

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Class: Programming & Problem Solving I; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Fall 2003;
Typology: Lab Reports
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Write a C++ program that reads in student scores. For each score it reads in, determine if the score is an A, B, C, D, or F, according to the scale given below. Your program should also keep track of the number of students in each grade category, and the average of all scores that the user inputs. Grading scale: A: score >= 90 B: 80 <= score < 90 C: 70 <= score < 80 D: 60 <= score < 70 F: score < 60 When your program executes, it should produce output as in the following sample dialogue: Enter all scores below, one score per line. Press control-d when done. 55 Input score is 55.00, grade F
Input score is 78.50, grade C 98 Input score is 98.00, grade A 77 Input score is 77.00, grade C
Input score is 80.55, grade B 90 Input score is 90.00, grade A Number of scores = 6 Average score = 79. Grade Number of Students A 2 B 1 C 2 D 0 F 1
C++ Statements Needed : Declaration for int and double variables. Input and output (cout << and cin >>). Loop, controlled by end of input. if-else statements. Function for the determination and output of the appropriate grade for a given score.
Do the following: Name your program file lab4.cpp and place it in your 174 subdirectory. Document your program following the Program Documentation Guide which may be accessed through http://www.cecs.csulb.edu/~lam/cecs174/course-notes.html Make sure your program’s output matches the sample dialogue given above. Use script to get a typescript file that captures: a) cat lab4.cpp b) g++ lab4.cpp c) a.out. Print and hand in a hardcopy of the typescript file. Demo your program on the due date.