What is this?
if(test[i]!=' ')
{ score=score+0;} If you don't do anything to the score, it's the same as adding zero. I would write it like this:
if (test [i] != ' ')
{
// There's an answer
if (test [i] == key [i]) score += 2;
else score -= 1;
} Secondly, it would be better to use the string class. I would read the entire line and pluck the two parts out as substrings.