I am writing a program for a class i am taking and I am having issues trying to learn how to compare "T" and "F" answers. Here is my code so far. My text book shows how to strcmp but only with strings like "Billy" and "Mary" nothing about single characters. Not asking for you to do my work, just honestly in need of help. Any help on how to or a link to a tutorial would be appreaciated. (towards bottom of source in the "void compareAnswers" function is where I am writing it, I commented out the function)
oh and the input is like AAA55554 TFTFTFTFTFTFTFTFTFTTF
the AAA... is studentID and the TFTF is the answers
any advice on how to compare the examAnswer to the stuAnswers? This part for changing to char:
char eA = examAnswer[i];
char sA = stuAnswers[i];
was my last experiment at it. My first one was to compare the;
strcmp(examAnswer[21], stuAnswers[21]) but thought that if the stuAnswer is wrong that it would stop comparing at the first wrong letter and return eaith the <0 or >0 value. I then thought it would have to be broken up per character to compare. I am just so lost.
ok i now found that the strcmp() does go character-by-character but seems to stop at the first character that isn't equal like with "Bill" and "Billy". How do I go pass like in a sequence of:
TFTFTFTF
TFTFFFTT
Since the 5th character(second row) is F and not T it would stop there wouldn't it? how do i make it compare the remaining answers? just an explanation or something, i do want to learn this.
Getting close for me to head home here soon got to wrap up things here in a little bit, I got the rest of my application done just still having issues with comparing the answers, any advice is appreciated. Will try it in a few days when I get back to a computer.