

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


One of the difficulties you had in Lab 4 was that the increments you made to a counter in a function seemed to have no effect in the main function since the counter was a local variable in the function. In this project you are to solve the problem using reference parameters (DO NOT use global variables). The specification of this project extends from Project 4 to include finding the standard deviation of the scores. 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 and standard deviation 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. Standard deviation = 13. Grade Number of Students A 2 B 1 C 2 D 0 F 1
C++ Statements Needed : Declaration for int and double variables. Predefined math functions. 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. This function should use some reference parameters.
Do the following: Name your program file lab5.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 lab5.cpp b) g++ lab5.cpp c) a.out. Print and hand in a hardcopy of the typescript file. Demo your program on the due date.