1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
//
//
//
//This function checks for whether a user entered any iteration of Yes or No.
int yorn(char check[])
{
//************If return 1; is placed here, the program loops through outputting "Would you like to continue? Please enter either
//************yes or no : \n", "It seems the character(s) you entered was not valid, please try again: \n" and \
//************"Press <enter> to continue."
//************If return 0; is placed here, the program will output "Would you like to continue? Please enter either
//************yes or no : \n" and "It seems the character(s) you entered was not valid, please try again: \n" once
//************and then end right away.
if(strcmp(check, "y") == 0 || strcmp(check, "Y") == 0 || strcmp(check, "yes") == 0 ||
strcmp(check, "yeS") == 0 || strcmp(check, "yEs") == 0 || strcmp(check, "yES") == 0 ||
strcmp(check, "Yes") == 0 || strcmp(check, "YeS") == 0 || strcmp(check, "YES") == 0)
{
return 1;
}else if(strcmp(check, "n") == 0 || strcmp(check, "N") == 0 || strcmp(check, "no") == 0 ||
strcmp(check, "nO") == 0 || strcmp(check, "No") == 0 || strcmp(check, "NO") == 0)
{
return 0;
}else
{
return 2;
}
}
|