i am using the cs50 online ide so i am also using the cs50 library at the top i am trying to make it so that when it asks are you okay it keeps asking the question until you either say upper or lowercase y or n
#include <cs50.h>
#include <stdio.h>
int main(void)
{
char answer;
do
{
char answer = get_char("are you okay Y/N ");
if (answer == 'y' || answer == 'Y')
{
printf("you are okay");
}
else if (answer == 'n' || answer == 'N')
{
printf("you are not okay ");
}
}
while(answer != 'y' || answer != 'Y' || answer != 'n' || answer != 'N');
}
Aucun commentaire:
Enregistrer un commentaire