So I've been trying to figure out how to use the correct condition for my if statements (I know there is some ugliness with the code itself but I'm concerned with the conditions atm). I want it to go into the if statement whenever "theguess" (a character enter by the user) equals the "H" or "h" in the first if statement, if it equals "T" or "t" in the second if statement, and if it does NOT equal "H", "h", "T", or "t" for the third. I previously had || instead of && but that also didn't work. Please halp me
There is no problem with the input or storage of the character into the variable, only my logic is flawed.
if (theguess == ('H') && ('h'))
{
P1score -= 5;
puts("-5 Points!");
}
if (theguess == ('T') && ('t'))
{
P1score += 10;
puts("+10 Points!");
}
if (theguess != ('H') && ('h') && ('T') && ('t'))
{
return 0;
}
Aucun commentaire:
Enregistrer un commentaire