I am taking a C programming class at my local college and we're starting on some of the bigger programs. I am breaking down the program into pieces so it's easier to manage, currently I'm trying to find away to use a yes/no loop for getting input from a user for a package deal and then verifying that the deal the user chose is what they actually wanted. If it wasn't what the user wanted it would repeat itself until the user input 'Y' and then go from there. If I find a way for it to do the loop the program just displays all of the printf functions over and over again with no exit to the loop or more input from the user. Any ideas?
#include <stdio.h>
int main()
{
char package_choice;
char package_verify;
do
{
printf("Which package would you like to select? ");
scanf("%c", &package_choice);
printf("You chose %c, correct?\n", package_choice);
printf("Y/N\n");
scanf(" %c", &package_verify);
}while(package_verify != 'Y' && package_verify == 'N');
printf("You chose package %c.", package_choice);
}
I've tried a number of retyping how the do...while loop works but I never get the result I am wanting. Is there another way to go about this or am I missing something?