Creating a True/False Test Grader

"Problem Statement
Your Xenobiology professor has decided to give you a completely True/False final exam. Since she discovered you are a C++ programmer, she has offered you extra credit if you will write a program to analyze the test data. This sounds good, so you have accepted the job.
Your task is to analyze the data file which contains the test answer key and each student's answers. To do this you will determine each student's test score and the mean for the entire class. Also you will generate a histogram using the test scores. There are exactly 25 students who took the exam.

Calculate the mean exam score as the sum of all scores divided by the number of scores, as a real number. Display the mean in your output with 2 digits of precision.

Input
The input file is named xfile.txt, and is available from the course web site. You may hardcode this specific filename into your program. Download the file from the course web space into the same folder which contains your .cpp file. The file has the following format:
1st data line: the test answer key, in columns 1 thru 30 (there are exactly 30 questions on the test)

Remaining data lines: a student name on one line, followed by the test answers recorded for that student on the next line. This pattern is repeated for all 25 students. The list is in alphabetical order by student name, and all data lines contain the required information starting in column one.

Output
•Echoprinted input (some of which is included in items below).
•A table giving the list of student names in the order they were read in, the test answers for that student, and the student's test score. This table will incorporate data error messages if needed.
•The mean test score.
•A histogram showing the number of students who received scores in the following ranges: 0 thru 5, 6 thru 10, 11 thru 15, 16 thru 20, 21 thru 25, and 25 thru 30. The histogram should look something like this:

Frequency
---------
Score Obtained By 5 10 15 20 25
----- ----------- ----|----|----|----|----|

0...5 1 *

6...10 7 *******

11...15 10 **********

16...20 3 ***

21...25 2 **

26...30 2 **


Data Structures
This project is intended to familiarize you with the use of standard one-dimensional arrays, parallel arrays, and basic use of the string class in C++. You are required to use one-dimensional arrays to store the test answer key (a one-dimensional array of char), the student's answers (a parallel one-dimensional array of char), and the frequency counts (a one-dimensional array of int) required for the histogram.
Use a C++ string class object to read, store and print out each student's name. Use either a C-string or the string class to hard-code your file name, which should be a string constant in this program.

You are required to use these core-language one-dimensional arrays and C++ string class objects in this project. You may not use any two-dimensional arrays, dynamic arrays, structs or user-defined classes on this project. You also may not use the C++ Standard Template Library classes or algorithms with the exception of using the C++ string class to store and work with the file name and student name string data in this program.

You are required to use the typedef construct to create your array types for the exam answer arrays and for the frequency counting array."

Please message me with any tips on this please and thank you. :)
Last edited on
What have you done so far? It sounds to me like you are going to want to use ifstream to read in the data for 25 students. Then compare their 30 0(false) , 1(true) to the answer key. Then add up how many answers they have correct.
Topic archived. No new replies allowed.