Good day. My infile contains the following:
TFFTFFTFFTFFTFTFTFTFFF A33 TFFTFFTFFFFFTFTFTFFFFT Z27 TFFTFFTFFTFFTFTFTFTFFT X12 TFTT FTFFTFFFT FTFTFFF H44 TFFTFFTFFTFFFFTFTFFTFF Q19 FFFFFFFFFFFFTFTFTFFFFF D72 TFFTFFTFFTFF FFFFFTFFF W32 FFFTFFTFFTFFTFTFTFFTTT Y09 TFFTFFTFFTFFTFFTTFFTTT S44 TFFTFFTFFTFFTFTFTFTFFF G11 FFTFFTFFTFFTFTFTTFTFFF J21 TFFTFFFFFTFFTFTFTFTFTT K61 TFFTFFTFFTFFTFTFTFTFT M03 TFFTFFTFFFFFTFTFTFTFFT P24 TFFTFFTFFTFFTFTFTFFFFT N54 FTFFTFFTFT TFF FTFTFFF F33 TFFTFFTFFTFFTFTFTFTFFF Z21 TFFTFFFTTFTTFFTFTFTFTF V39 TFFFTTFTTFTTFTFTFTTFFF O66 TTFTFFTFFTFFTFTFTFTFFF B29 TFFTFFTFFTFF FFTTFFTFF J17 TFFTFFFTTTFFTFFTFTFTTT K09 TFFTFFTFTTFTTFTFTFFTFF L99 FFTFFTFFTFFFFTFTFTFFF
The history teacher at the school needs help in grading a True/False test. The
student lD’s and test answers are stored (vertically) in a file named "tftest.txt". The
first entry in the file contains answers to the test in the form
All of the other entries in the file are data for a student on 2 lines:
Note that this student did not answer question 9. The test has 22 questions and
there are not more than 50 students in the class. Each correct answer is awarded 5
points, each incorrect answer is awarded -2 points (negative) and each "no answer"
gets a value of -4 points (negative).
lt can be seen that all test scores will be a whole number.
The student in the example achieved a grade as follows:
14 correct * 5 = 70
7 incorrect * -2 = -14
1 no answer *-4 = -4
70 - 14 -4 = 52 F
His output line would look like:
A43 TFFTFFTT TFTFTFFTTFTTT 52 F
The output should be the student’s ID, the student’s answers followed by the test
score and the test grade. The grade scale is:
Above 90 = A
80 - 89 = B
70 - 79 = C
60 - 69 = D
Below 60 = F
The program should finally display the class average (2 decimals)
...Now where do i even begin? Since the 1st line contains the correct answer...how do i store them so that the other lines are compared to it for the correct answer. I really need a jumpstart with this one. If i use a getline function for example...how will it diffrentiate between the answers i wanna check and the student's id #?
Thanks for all the pointers & input.