So when running the program the array labeled CorrectAnswers outputs
perfectly. However the array studentAnswers outputs random symbols character or number. Any help would be greatly appreciated.
At lines 21 to 31, inputFile is used to read from two different files into the arrays
CorrectAnswers and studentAnswers. That looks almost ok. The part which looks wrong is the use of the same variable count in both cases.
The variable should be reset to zero, before commencing to read from the second file. But then of course, the existing value will be lost. So I think two separate variables need to be used - after all there's no guarantee that the number of items read from the two files will be the same.
Later, there are loops such as at line 35 while(counter < SIZE) and at line 57 for(int count = 0; count < SIZE; count++) where it is assumed that the arrays will contain exactly SIZE items. But what happens if one or other of the files contained fewer than that?
Fixed the count variables to different variables for each one and in this particular program it will only be reading from these 2 files already in the computer due to it being an assignment. So the const variable SIZE is being used for both arrays and each file contains the exact same number of characters. For whatever reason it is still doing the same output for the second file I commented everything out and did a
for(int countD = 0; countD < SIZE; countD++)
cout << studentAnswers[countD];
and it gives the exact same output as from the for loop comparing them it seems there is something wrong with that array or file. From what I can see in the file the the file itself is fine. Something goes wrong from it reading the file and storing it in the array and when it outputs the array.
Ok I fixed this issues somehow I opened a new source code in dev and wrote a small program to read that particular file and output it from an array. It worked there so I commented out the old one copy and pasted and it worked fine. I can only guess it was a Dev error.
If you mean the compiler got it wrong, I think that is extremely unlikely. Much more likely you overlooked an error in your code - which happens to all of us :)