This is supposed to read the values listed in the studentFile "StudentAnswers.txt" and put those values into the studentAnswers array. I'm not entirely sure if this is how it's supposed to work, though.
And for the studentGrade variable, I've tried doing this:
1 2 3 4 5 6
if (sameAnswer)
cout << "The answer is correct.\n";
studentGrade + 5;
else
cout << "The answer is wrong.\n";
while (sameAnswer && count < QUESTIONS)
{
if (studentAnswers[count] != correctAnswers[count])
sameAnswer = false;
count++;
}
if (sameAnswer)
cout << "The answer is correct.\n";
studentGrade + 5; //I copyed from this from your second post
else
cout << "The answer is wrong.\n";
This couldn't posible work because you did not assign the result to anything, use += operator. studentGrade + 5;
And it should be inside the while loop, so that you could perfor this check:
1 2
if (studentGrade >= 70)
cout << "Congratulations! You passed." << endl;
And in your while loop shouldn't check sameAnswer, because your way it stops at the first wrong answer (that is why (quoting you)"this part of the code is just flat out being ignored") and since you want to check all answers you don't need this variable at all. while (sameAnswer && count < QUESTIONS)
Insted of your if statement in the while loop (which by thw way is in your code just an extension of condition for the while loop), you should use == operator and if it is true do studentGrade += 5; that would give you 5 points for each correct answer.
And this code is just sencless if you put it outside the while loop
1 2 3 4 5 6
if (sameAnswer)
cout << "The answer is correct.\n";
else
cout << "The answer is wrong.\n";