Complies but does not read contents from file

Write your question here.
Last edited on
My code runs but it doesn't read contents from the files and I have no idea why.

When you say "doesn't read contents from the files", are the files able to be opened?
yes they are able to open , just want my code to read the file. Here is a sample of one the txt files
CorrectAnswers.txt
A
D
B
C
A
A
D
B
D
C
A
D
B
A
C
C
D
B
C
A
Last edited on
Just because the files are present doesn't mean they're able to be opened.

What is the format in the files?
I have it as a txt file and I saved it in my documents
Last edited on
1
2
string correctAnswers[size];
string studentAnswers[size];


You are supposed to read the data into an char array and not in an array of string.
Write a program that reads the contents of the CorrectAnswers.txt file into a char array, and then reads the contents of another file, containing a students answers, into a second char array.
Wow thanks for heads up
Thomas1965 wrote:
You are supposed to read the data into an char array and not in an array of string.

That may or may not be related to the problem being experienced. All depends on the format of the files.

Does the format of the student answers file match that of the correct answers file (each 'answer' on it's own line?)
Topic archived. No new replies allowed.