Complies but does not read contents from file

Nov 15, 2015 at 8:53pm
Write your question here.
Last edited on Nov 15, 2015 at 11:20pm
Nov 15, 2015 at 9:44pm
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?
Nov 15, 2015 at 9:56pm
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 Nov 15, 2015 at 10:05pm
Nov 15, 2015 at 10:02pm
Just because the files are present doesn't mean they're able to be opened.

What is the format in the files?
Nov 15, 2015 at 10:15pm
I have it as a txt file and I saved it in my documents
Last edited on Nov 15, 2015 at 10:17pm
Nov 15, 2015 at 10:15pm
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.
Nov 15, 2015 at 10:23pm
Wow thanks for heads up
Nov 15, 2015 at 10:23pm
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.