I'm doing part two of my programming project for my course in university. this time around we are using a loop, while loop. my first fgets in the loop runs and so does the rest although i have problems from time to time. but the last one that is take the loop variable and change it after a prompt never runs. why?
I know that this is a common issue but i can't find a fix to my problem at on the other questions.
printf("Would you like to place an order? Enter 'yes'"
"\n If not, Enter 'XXX':\n");
fgets(loop, sizeof(loop),stdin);
while(strcmp(loop,"XXX")!=0){
printf("Please provide your company name: \n");
fgets(company_n, sizeof(company_n), stdin);
printf("Please provide name: \n");
fgets(contact_name, sizeof(contact_name), stdin);
printf("Please provide contact number: \n");
fgets(tel_num, sizeof(tel_num), stdin);
//Items//
printf("\t\t\t\t Our Apparels: \n");
printf("\t\t\tApparels\t\tItem code\n");
printf("\t\t\ta)T-Shirts\t\t'T'\n");
printf("\t\t\tb)Bags\t\t\t'B'\n");
printf("\t\t\tc)Caps\t\t\t'C'\n\n");
//reading item code//
printf("Enter corresponding item code: \n");
scanf(" %c",&code);
printf("How much of this item would you like to order:\n");
scanf("%i",&amount);
printf("Would you like to place another order? Enter 'yes'"
"\n If not, Enter 'XXX':\n");
fgets(loop, sizeof(loop),stdin);
}