Xiang
05-24-2003, 04:11 PM
Dear sir,
Refers to the below coding. If user enters FF or MM, the condition was turn to the true. But, I would like to turn this wrong answer to the false condition, how can I do???
printf("Enter your gender [F/M] : ");
scanf("%c", &gender);
if (gender == 'F');
printf('You are Female");
else if (gender == 'M')
printf("You are Male");
else
printf("Invalid gender"); //false condition
Thanks,
Xiang
Refers to the below coding. If user enters FF or MM, the condition was turn to the true. But, I would like to turn this wrong answer to the false condition, how can I do???
printf("Enter your gender [F/M] : ");
scanf("%c", &gender);
if (gender == 'F');
printf('You are Female");
else if (gender == 'M')
printf("You are Male");
else
printf("Invalid gender"); //false condition
Thanks,
Xiang