You check some user input against 'Y' and 'N' but user input can be 'y' or 'n', in which case your test fail.
Solutions:
- you need to force user to input uppercase.
- add a check for 'y' and 'n' too.
- test with uppercase if user input; by using the
toupper
function.
If user input can only be 'Y' and 'N', your code can be simplified because if iris not one, it is automatically the other.
if ((studentAnswer == 'Y') || (seniorCitizenAnswer == 'Y'))
{
}
else if ((studentAnswer == 'N') && (seniorCitizenAnswer == 'N'))
{
}