Compare Input Data to File Data

I'm making a trivial pursuit type game. There's 5 questions, and each question you're able to answer with 1, 2, 3 or 4. I'm required to use a data file as an answer key instead of using logic statements. So I have a data file "answer.txt", the answers listed are:

1
3
2
4
1

How would I compare the user input (q1,q2,q3,q4,q5) to the data file to figure out which ones are right and wrong?
-You store the user inputs in an array, in the correct sequence.

-You open the file, and read the data into another array, in the correct sequence :D

-You compare the two arrays, element-wise.
You're going to first have to learn how to read in data files!

http://www.cplusplus.com/doc/tutorial/files/



Topic archived. No new replies allowed.