Comparing an Answer Key with Test

Mar 5, 2013 at 1:43am
Hi,
I've been trying to figure out how to compare two strings and to output the amount of letters match and don't match and display which ones those were, like in an answer key.
Say, there is a True/False test written by a student and the answer key is FTFF. He writes FTTT. Therefore he will get 50%, and questions three and four were wrong.
How do you go about this? Maybe I'm missing something blatantly obvious but I can't figure it out. Maybe I'm not supposed to use strings? Anyone got an answer?
Mar 5, 2013 at 2:14am
Can you go through each string char by char and compare? Use an array to store which answers where correct.
Mar 5, 2013 at 2:19am
I think that's what I'm getting at, yeah. How would I go about doing that? I'm very new to this stuff, not too familiar with everything.
Mar 5, 2013 at 2:37am
Read this:

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


Also be aware of the reference info and articles at the top left of this page.

Have a go, post your code (make sure to use code tags - the <> button on the right), and post any compiler errors if you have any.

HTH
Last edited on Mar 5, 2013 at 2:39am
Topic archived. No new replies allowed.