I'm making this Pizza order system code where the Customer chooses the type and the size of the pizza and also can order up to 10 pizza's. The problem is that the program is skipping the last printf() statement the one inside the if statement within the while loop which asks the customer whether he wants more than one pizza.I didn't copy all the functions because it will be really long code but if the problem could be there then I paste them directly to see.
I tried to write just printf() statement without the if statement and still being skipped.
int main()
{
printf("Hello! Welcome to UASKPS!\n");
printf("You can order up to 10 pizzas.\n\n");
printf("\nPress any key to start your order.\n");
_getch();
// let user order a single pizza in each loop run
char c;
nr_pizzas_ordered = 0;
do
{
system("cls");
// show pizza number
printf("\nPlease choose your pizza #%d\n", nr_pizzas_ordered + 1);
// let user choose pizza type
enum pizza_types desired_type = choose_pizza_type();
// let user choose pizza size
enum pizza_sizes desired_size = choose_pizza_size();
// store the order
all_pizza_orders[nr_pizzas_ordered].which_pizza = desired_type;
all_pizza_orders[nr_pizzas_ordered].which_size = desired_size;
// one pizza has been ordered more
nr_pizzas_ordered++;
// ask user whether he wants to order another pizza
if (nr_pizzas_ordered < 10)
{
printf("Do you want to order another pizza? (y/n)\n");
c = _getch();
}
else
c = 'n';
} while (c == 'y');
show_order_list();
printf("\n\nThank you for your order! Press any key to exit.\n");
_getch();
}