C++/Array Processing using C++
I have to grade a true/false test. The students' IDs and test answers are stored in a file. the first entry in the file contains answers in this form: TFFTFFTTTTFFTFTFT
Every other entry in the file is the students id followed by a blank, followed by the students response. It should look like this: ABC54301 TFTFTFTT TFTFTFFTTFT, which indicated the student id and their test scores. the exam has 20 questions and the class has more than 150 students. each correct answer is worth 2 points wrong answer is worth -1 and not asnswer gets 0 points. the grading scale is 90-100 A; 80-89.9 B; 70-79.9 C; 60-69.9 D; and 0-59.9 F.
I am totally confused on how to so this.
I will give you a good approach to solving any programming problem. Don't be tempted to turn on the computer and write code. If you build a house, you don't just pick up the hammer and nails.
What you need to do is well defined - that is, you have a specification. I would start with a flow chart or flow diagram of the problem. How to start? The easiest thing to do is to pretend you are the computer. Take the first 4 entries in the file and do what this specification asks you to do. You have to know what to do before you can tell (program) the computer to do it. When you know how you will process the data, you can write the program to do the processing.
Write down the inputs and outputs, and what you need to do with the input to get the outputs. Think about how you will store the data. If you need to use an array, then you need an array of something. Probably a class. What does the class need to hold? Probably the ID, answer string, and score. Member functions might be defined load and store the ID an answer. And to calculate the score and the grade.
If you have an array of this class, you fill in the class members as you read the file, and store the class in the array (the count of the record is the array index).