I am trying to make my program run only while the user enters Y or y but it only runs once, and even if it isn’t Y or y. Input will either be Y, y, N or n
printf("Welcome to the Jumble Puzzle Solver!\n\n");
printf("Would you like to enter a jumbled word?\n");
scanf("%s", &answer);
do{
printf("What word would you like scored?\n");
scanf("%s", &letters);
strcpy(changeletters, letters);
recursivepermute(letters, changeletters, checkword, k, dictionary ,max, min);
printf("Would you like to enter a jumbled word?\n");
scanf("%s", &answer);
}while (answer == 'Y' || answer == 'y');
do { } while()causes the body to always be executed at least once. If you want the condition checked first, just use while:You also need to use
scanf("%c"ifansweris achar. The%sis to scan a string of characters (ie:char[20]), and would need to be checked differently, using a method likestrcmpor similar.