HI,

Im 20f doing course on multimedia game development. Im very new to C++ and not familiar with the codes. Can someone helps assisting as my assignment due soon.
I have only left this 1 task to complete..
My lecturere had covered some fstreams chapters, enum struct and string.

Assignment 1 Page 1
You are to write a program (grade.cpp) to grade a True/False test. The test consists of
20 questions and the class has 10 students.
The students' names and test answers are stored in a text file, test.txt. The first line in
the file contains the correct answers in the form of T or F. As an example:
FTFFTTFFFTTTFFFFTTTT
means answer to question 1 is False, question 2 is True, question 3 is False, etc.
Assignment 1 Page 2
Subsequent lines (10 of them) are the students’ names and their answers. Each line consists
of the student's name, followed by a blank and followed by the student's answers. For
example, the entry:
Jack TTFFT TTFFTTTTFFFFTT
indicates that the student's name is Jack and the answers to question 1 is True, question 2 is
True, question 3 is False, etc. Student Jack did not answer question 6.
Each correct answer is awarded 2 marks, each wrong answer will deduct 1 mark, while no
answer gets 0 mark.
Your program shall perform the following:
1. Read the test file and compute the score of all students.
2. Display individual student's name, score and grade. Grade is computed based on
following table:
Score Grade (in percentage)
score < 50 F
50 <= score < 60 D
60 <= score < 70 C
70 <= score < 80 B
score >= 80 A
3. Display the following summary:
a. The highest score and the student name
b. The lowest score and the student name
c. The average score for the class

INPUT file: test.txt
FTFFTTFFFTTTFFFFTTTT
Angie FTFFTTFFFTTTFFFFTTTT
Grace FFFFFFFFFFFFFFFFFFFF
Fiona FTFFTTFFFTFFTTTTFFFF
Helen TFTTFFTTTFFFTTTFTTTT
Bernard TFFFTTFFFTTTFFFFTTFF
Charlie FT FTTFF TTTF FFTTTT
Desmond FTF TTF F TTF FFT TT
Eve TFFTTFFFTTTFFFFTTT
Isaac F F T F F T F F T T
Jack TF FT FF TT FF FT FF


Example of expected result.
FTFFTTFFFTTTFFFFTTTT

Angie FTFFTTFFFTTTFFFFTTTT
Correct: 20 Incorrect: 0 Not Attempted: 0
40 (100%) Grade A

Grace FFFFFFFFFFFFFFFFFFFF
Correct: 10 Incorrect: 10 Not Attempted: 0
10 (25%) Grade F

Fiona FTFFTTFFFTFFTTTTFFFF
Correct: 10 Incorrect: 10 Not Attempted: 0
10 (25%) Grade F

Helen TFTTFFTTTFFFTTTFTTTT
Correct: 5 Incorrect: 15 Not Attempted: 0
0 (0%) Grade F

Bernard TFFFTTFFFTTTFFFFTTFF
Correct: 16 Incorrect: 4 Not Attempted: 0
28 (70%) Grade B

Charlie FT FTTFF TTTF FFTTTT
Correct: 17 Incorrect: 0 Not Attempted: 3
34 (85%) Grade A

Desmond FTF TTF F TTF FFT TT
Correct: 13 Incorrect: 2 Not Attempted: 5
24 (60%) Grade C

Eve TFFTTFFFTTTFFFFTTT
Correct: 18 Incorrect: 0 Not Attempted: 2 (first & last)
36 (90%) Grade A

Isaac F F T F F T F F T T
Correct: 10 Incorrect: 0 Not Attempted: 10
20 (50%) Grade D

Jack TF FT FF TT FF FT FF
Correct: 10 Incorrect: 4 Not Attempted: 6
16 (40%) Grade F


The highest score and the student name
Angie: 100 marks

We generally do not provide canned answers to problems.
Especially not homework problems.
We prefer to help you help yourself.

In your case, first think about the problem. Think about the steps you would follow to solve the problem by hand. Use that plan as a basic design for the program.

Then once you have some code, we're great at providing answers to problems like "The program is doing ___, I expected it to do ___"

The more specific you are about what it is doing that you don't like and what you wanted it to do, the better the answers you will get. (With good questions, the answers tend to come faster as well.)

When you go to post your c++ code, please use c++ code tags
[code=c++] // Your code here

[/code]

This article has been dead for over six months. Start a new discussion instead.