I created a C Program that will take all the order of the user then generate the grandtotal of the orders.

But when I will order another food, the program is closing automatically.

I don't know if this is about my getch or the breaks in my switch method. Sometimes, it will proceed to take another error but it automatically outputs "INVALID FOOD".

Here is my code:

```
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

void menu();
void foods();
void main();
char food;
int quantity;
float price;
float total;
float grandtotal;
int choice;

void main()
{
    clrscr();
    menu();

    foods();
    getch();
}

void menu(){

    food = ' ';
    quantity = 0;
    price = 0;
    total = 0;
    choice = 0;
    printf("Please select food from the following:\n");
    printf(" B = Burger, F = French Fries, P = Pizza, S = Sandwiches \n");

    printf("Enter food:");
    scanf("%c", &food);
}

void foods(){
    switch(food)
    {
        case 'B':
            printf("You selected Burger!\n");
            printf("Enter quantity:");
            scanf("%d", &quantity);
            price = 95.50;

            printf("\n Do you want to order more? [1] Yes [2] No:");
            scanf("%d", &choice);

            total = price*quantity;

            if(choice == 1){
                menu();
                break;
            }
            else if (choice == 2){
                grandtotal = grandtotal + total;
                printf("\n Total Price is: %0.2f", grandtotal);
                break;
            }

        case 'F':
            printf("You selected French Fries!\n");
            printf("Enter quantity:");
            scanf("%d", &quantity);
            price = 47.75;

            printf("\n Do you want to order more? [1] Yes [2] No:");
            scanf("%d", &choice);

            total = price*quantity;
            if(choice == 1){
                menu();
                break;
            }
            else if (choice == 2){
                grandtotal = grandtotal + total;
                printf("\n Total Price is: %0.2f", grandtotal);
                break;
            }

        case 'P':
            printf("You selected French Pizza!\n");
            printf("Enter quantity:");
            scanf("%d", &quantity);
            price = 105.00;

            printf("\n Do you want to order more? [1] Yes [2] No:");
            scanf("%d", &choice);

            total = price*quantity;
            if(choice == 1){
                menu();
                break;
            }
            else if (choice == 2){
                grandtotal = grandtotal + total;
                printf("\n Total Price is: %0.2f", grandtotal);
                break;
            }

        case 'S':
            printf("You selected Sandwiches\n");
            printf("Enter quantity:");
            scanf("%d", &quantity);
            price = 75.50;

            printf("\n Do you want to order more? [1] Yes [2] No:");
            scanf("%d", &choice);

            total = price*quantity;
            if(choice == 1){
                main();
                break;
            }
            else if (choice == 2){
                grandtotal = grandtotal + total;
                printf("\n Total Price is: %0.2f", grandtotal);
                break;
            }

            default:
            printf("INVALID FOOD!");
            break;

    }
}

```

I wish someone could help or guide me. Thanks in advance.