Thread: creating a menu system

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    12

    creating a menu system

    Hi im trying to create a basic menu system, where by the user inputs how many of an item they want and then it will output the result at the end, after the whole order has been accounted for, i have just started out and thought the best method would be to do some nested for and if statements, also using case statements. the problem i am facing is that when i run the code I receive a run time check error 3, i know that my code for the whole menu isnt complete, but i don't know what i am missing for the "burger_switch(), if someone could give me some idea as to where i am going wrong that would be most helpfll. i am using Microsoft C++ express 2010
    Code:
    #include <stdio.h>
    #define sentinel 999
    
    
    int burger_function();
    int burger_switch();
    int vegiburger_function();
    int chicken_function();
    int kids_function();
    int fish_function();
    int salad_function();
    int x;
    
    
    int main()
    {
    	int x;
    	printf("welcome to the MegaBite resturaunt, here is the menu\n");
    	printf("Burgers - Plain, Cheeseburger, Ketchup\n");
    	printf("Vegiburger - Plain, Cheeseburger, Ketchup\n");
    	printf("Chicken - Piri Piri, Spicy, Mild\n");
    	printf("Kids Meals - Sausage and chips, Ham and Chips, Fishfingers and Chips\n");
    	printf("Fish - Cod, Haddock, Scampi\n");
    	printf("Salad - Bean Salad, Caesar Salad, Garden salad\n");
    	printf("when your ready to order press 1, then enter\n");
    	printf("to restart at any time press 999\n");
    	scanf("%d\n", &x);
    	if (x == 1)
    		burger_function();
    
    
    }
    
    
    int burger_function()
    {
    	int x;
    	printf("would you like a burger, Press 1 for Yes, 2 for No\n");
    		scanf("%d\n", &x);			
    			if (x ==1)
    				burger_switch();
    		return 0;
    }
    										
    int burger_switch()		
    {
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    switch(x)
    case '1': 
    	printf("Would you like a burger 1 for Yes 2 for No\n");
    	scanf("%d\n", &a);
    		if (a=1)
    			printf("how many would you like?\n");
    				scanf("%d\n", &b); 
    							{{printf("How many plain burgers would you like?\n");
    									scanf("%d\n", &d);}
    									if (d>b) 
    										{printf("invalid data, please re enter amount\n");} 
    									else
    										{printf("How many cheese burgers would you like?\n");
    												scanf("%d\n", &e);}
    												if (e>b-d) 
    													{printf("invalid data, please re enter amount\n");} 
    												else
    													{printf("How many ketchup burgers would you like?\n");
    															scanf("%d\n", &f);}
    																if (f>b-(d+e)) 
    																{printf("invalid data, please re enter amount\n");} }
    
    
    																return 0;
    														}

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    What you wrote is really cute... but the answer to your problem lies in "i have just started out and thought the best method would be to do some nested for and if statements, also using case statements" ... trust me this is not how you write a program.


    1) Before you even begin coding you have to understand the task in little tiny bits... What is this supposed to do?

    2) Once you understand the problem, you can begin to plan a solution, writing a step by step procedure --in little idiot sized steps-- that does what you need. Think always "What's the simplest way to do this?", "Which way makes the most sense?"

    Notice how I've not mentioned program code or programming languages to this point? That's be cause nobody can ever code a solution to a problem they do not understand...

    3) Now you can fire up the computer and working from your plan you can begin writing your code according to your plan, testing in small blocks as you add each new step to the code.

    4) Finally, test your program, make sure it's giving you correct outputs and behaves as required...


    What you have is playing with a bunch of nifty functions and pretty looking code... not a solution based on the requirement.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Location
    IL
    Posts
    7
    Don't know if this is going to fix your problem, but the error may be in your burger_switch function (line 53). You have a global variable "int x" (line 12) and local variables "int x" (lines 17 and 37) in main and burger_function. Because there is no variable x declared in the burger_switch function, and because the global variable x is not initialized, your switch statement is taking action based on the "garbage" value contained in that global value.

    I definitely would suggest taking a little time and plan out your program, as stated above. It will minimize the amount of debugging headaches when it comes to the testing phase.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Code:
        printf("Would you like a burger 1 for Yes 2 for No\n");
        scanf("%d\n", &a);
            if (a=1)
                printf("how many would you like?\n");
                    scanf("%d\n", &b);
                                {{printf("How many plain burgers would you like?\n");
                                        scanf("%d\n", &d);}
                                        if (d>b)
                                            {printf("invalid data, please re enter amount\n");}
                                        else
                                            {printf("How many cheese burgers would you like?\n");
    Also think about how you would actually like to order in a real restaurant.
    You would never be asked the first two questions, then expect to do some complicated maths in your head (not knowing what the future questions would be).

    It's more like
    - how many plain burgers
    - how many cheese burgers
    - how many ....

    Then at the end, you say
    You've ordered a total of x burgers - OK?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    This should be a very simple task...
    List the available choices...
    For each choice the user makes ask how many...
    Keep track of the otal price,
    Tack on the taxes and get the slob's money...

    You want to make it as easy for the customer as you possibly can...

    Code:
    Please select...
    
    1) Plain Burger
    2) Jumbo Burger
    3) Jumbo Burger with Chees
    4) Fries
    5) Soft drink
    6) Apple Pie
    7) Icecream
    8) Done
    
    Enter your choice: 3
    How many Jumbo burgers with Cheese : 1
    
    Enter your choice : 8
    Please pay :
        1 Jumbo Burder with Cheese  $5.99
                          Tax                 $0.79
                          Total               $6.78
    
    Welcome to Bills Better Burger Barn...
    Press Enter to begin...

  6. #6
    Registered User
    Join Date
    Nov 2011
    Posts
    12

    update

    thanks for the responses, i have started again with my menu system and have come up with this code, it should have an output similar to what tater had described above. the problem i face now is with the void printorder_function();, i get an error code of C2449, for the open brackets, can someone please explain what i have done wrong please

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    void printorder_function();
    int menu_function;
    int x;
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    int g;
    int h;
    int i;
    int j;
    int k;
    int l;
    int m;
    int n;
    int o;
    int p;
    int q;
    int r;
    
    
    int main()
    {
    
    
        printf("press 1 for Plain Burger\n");
        printf("press 2 for Cheese Burger\n");
        printf("press 3 for Ketchup Burger\n");
        printf("press 4 for Plain VegiBurger\n");
        printf("press 5 for Cheese VegiBurger\n");
        printf("press 6 for Ketchup VegiBurger\n");
        printf("press 7 for Piri Piri Chicken Meal\n");
        printf("press 8 for Spicy Chicken Meal\n");
        printf("press 9 for Mild Chicken Meal\n");
        printf("press 10 for Kids Meal - Sausage and Chips\n");
        printf("press 11 for Kids Meal - Fishfingers and Chips \n");
        printf("press 12 for Kids Meal - Chicken Nuggets and Chips \n");
        printf("press 13 for Cod\n");
        printf("press 14 for Haddock\n");
        printf("press 15 for Scampi\n");
        printf("press 16 for Bean Salad\n");
        printf("press 17 for Caesar Salad\n");
        printf("press 18 for Garden Salad\n");
        printf("press 19 for When finished\n");
        printf("press 20 to restart\n");
    
    
        scanf("%d\n",&x);
        
        printf("enter your choice: %d\n", &x);
        return 0;
    }
    
    
    int menu_fucntion()
    {
        switch(x)
        {
        case '1': printf("how many plain burgers would you like?: ");
                    scanf("%d\n", &a); break;
        
        case '2': printf("how many cheese burgers would you like?: ");
                    scanf("%d\n", &b); break;
    
    
        case '3': printf("how many ketchup burgers would you like?: ");
                    scanf("%d\n", &c); break;
        
        case '4': printf("how many plain Vegiburgers would you like?: ");
                    scanf("%d\n", &d); break;
    
    
        case '5': printf("how many Cheese Vegiburgers would you like?: ");
                    scanf("%d\n", &e); break;
        
        case '6': printf("how many Ketchup Vegiburgers would you like?: ");
                    scanf("%d\n", &f); break;
    
    
        case '7': printf("how many Piri Piri Chicken Meals would you like?: ");
                    scanf("%d\n", &g); break;
        
        case '8': printf("how many Spicy Chicken Meals would you like?: ");
                    scanf("%d\n", &h); break;
    
    
        case '9': printf("how many Mild Chicken Meals would you like?: ");
                    scanf("%d\n", &i); break;
        
        case '10': printf("how many Kids Meal Sausage and Chips would you like?: ");
                    scanf("%d\n", &j); break;
    
    
        case '11': printf("how many Kids Meal Fishfingers and Chips would you like?: ");
                    scanf("%d\n", &k); break;
    
    
        case '12': printf("how many Kids Meal Chicken Nuggets and Chips would you like?: ");
                    scanf("%d\n", &l); break;
        
        case '13': printf("how many cod meals would you like?: ");
                    scanf("%d\n", &m); break;
    
    
        case '14': printf("how many haddock meals would you like?: ");
                    scanf("%d\n", &n); break;
        
        case '15': printf("how many scampi meals would you like?: ");
                    scanf("%d\n", &o); break;
    
    
        case '16': printf("how many bean salads would you like?: ");
                    scanf("%d\n", &p); break;
    
    
        case '17': printf("how many caesar Salads would you like?: ");
                    scanf("%d\n", &q); break;
        
        case '18': printf("how many garden salads would you like?: ");
                    scanf("%d\n", &r); break;
    
    
        case '19': printorder_function(); break;
            
        case '20': system("cls");
                      main();
        
        default: printf("Error, please enter valid characters\n");break;
    }
    
    
    }
    
    
    void printorder_function();
        {
        system("cls");
        printf("Your order is:\n");
        printf("%d,:Burgers,  %d, Plain Burgers,  %d,Cheeseburgers,  %d, Ketchup Burgers\n\n",(a+b+c),a,b,c);
        printf("%d,:VegiBurgers,  %d, Plain VegiBurgers,  %d, Cheese Vegiburgers,  %d, Ketchup VegiBurgers\n",(d+e+f),d,e,f);
        printf("%d,:Chicken,  %d, Piri Piri Chicken,  %d, Spicy Chicken,  %d, Mild Chicken\n\n",(g+h+i),g,h,i);
        printf("%d,:kids meal,  %d, kids meal- Sausage and chips ,  %d, kids meal - fishfingers and chips,  %d, kids meal- Chicken nuggets and chips\n\n",(j+k+l),j,k,l);
        printf("%d,:Fish,  %d, Cod,  %d, Haddock,  %d, Scampi\n\n",(m+n+o),m,n,o);
        printf("%d,:Salads,  %d, Bean Salad,  %d, Caesar Salad,  %d, Garden Salad\n\n",(p+q+r),p,q,r);
        }

  7. #7
    Registered User
    Join Date
    Oct 2011
    Posts
    23
    You could use puts instead of printf when you only want to print a string to console.
    See this tutorial for more on how to create menus:
    Dystopian Code: Creating a Console Menu in C\C++

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by openwindow View Post
    Code:
    int x;
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    int g;
    int h;
    int i;
    int j;
    int k;
    int l;
    int m;
    int n;
    int o;
    int p;
    int q;
    int r;
    OMG!!! O_o ... Ok, I can die now...
    Devoted my life to programming...

  9. #9
    Registered User
    Join Date
    Nov 2011
    Posts
    12
    what could I use then instead of all these int variables?
    im quite new to programming, so i though this was the best way

  10. #10
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    I'd say array, but assuming that you don't know how to use them yet, how about some meaningful names for the variables? Believe me, you don't want these variable names in a 10,000 lined program. ( It's a good practise to do so, eg instead of "a" say "plainBurgers" or something )
    Devoted my life to programming...

  11. #11
    Registered User
    Join Date
    Nov 2011
    Posts
    12
    i have done some very basic work with array, is this the sort of thing you mean?

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    void printorder_function();
    int menu_function();
    int x;
    int menuarray[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* initially values will be 0 */
    int z;
    
    
    int main()
    {
        int x;
        printf("press 1 for Plain Burger\n");
        printf("press 2 for Cheese Burger\n");
        printf("press 3 for Ketchup Burger\n");
        printf("press 4 for Plain VegiBurger\n");
        printf("press 5 for Cheese VegiBurger\n");
        printf("press 6 for Ketchup VegiBurger\n");
        printf("press 7 for Piri Piri Chicken Meal\n");
        printf("press 8 for Spicy Chicken Meal\n");
        printf("press 9 for Mild Chicken Meal\n");
        printf("press 10 for Kids Meal - Sausage and Chips\n");
        printf("press 11 for Kids Meal - Fishfingers and Chips \n");
        printf("press 12 for Kids Meal - Chicken Nuggets and Chips \n");
        printf("press 13 for Cod\n");
        printf("press 14 for Haddock\n");
        printf("press 15 for Scampi\n");
        printf("press 16 for Bean Salad\n");
        printf("press 17 for Caesar Salad\n");
        printf("press 18 for Garden Salad\n");
        printf("press 19 for When finished\n");
        printf("press 20 to restart\n");
    
    
        menu_function();
        printorder_function();
    
    
        return 0;
    }
    
    
    int menu_function(int x)
    
    
    {
        printf("enter your choice: ");
        scanf("%d\n",&x);
        switch(z=x)
            
        {
        case '1': printf("how many plain burgers would you like?: ");
                    scanf("%d\n", &menuarray[0]); break;
        
        case '2': printf("how many cheese burgers would you like?: ");
                    scanf("%d\n", &menuarray[1]); break;
    
    
        case '3': printf("how many ketchup burgers would you like?: ");
                    scanf("%d\n", &menuarray[2]); break;
        
        case '4': printf("how many plain Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[3]); break;
    
    
        case '5': printf("how many Cheese Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[4]); break;
        
        case '6': printf("how many Ketchup Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[5]); break;
    
    
        case '7': printf("how many Piri Piri Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[6]); break;
        
        case '8': printf("how many Spicy Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[7]); break;
    
    
        case '9': printf("how many Mild Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[8]); break;
        
        case '10': printf("how many Kids Meal Sausage and Chips would you like?: ");
                    scanf("%d\n", &menuarray[9]); break;
    
    
        case '11': printf("how many Kids Meal Fishfingers and Chips would you like?: ");
                    scanf("%d\n", &menuarray[10]); break;
    
    
        case '12': printf("how many Kids Meal Chicken Nuggets and Chips would you like?: ");
                    scanf("%d\n", &menuarray[11]); break;
        
        case '13': printf("how many cod meals would you like?: ");
                    scanf("%d\n", &menuarray[12]); break;
    
    
        case '14': printf("how many haddock meals would you like?: ");
                    scanf("%d\n", &menuarray[13]); break;
        
        case '15': printf("how many scampi meals would you like?: ");
                    scanf("%d\n", &menuarray[14]); break;
    
    
        case '16': printf("how many bean salads would you like?: ");
                    scanf("%d\n", &menuarray[15]); break;
    
    
        case '17': printf("how many caesar Salads would you like?: ");
                    scanf("%d\n", &menuarray[16]); break;
        
        case '18': printf("how many garden salads would you like?: ");
                    scanf("%d\n", &menuarray[17]); break;
    
    
        case '19': printorder_function(); break;
            
        case '20': system("cls");
                      main();
        
        /*default: printf("Error, please enter valid characters\n");break; */
    }
    return 0;
    }
    
    
    void printorder_function()
    {
        system("cls");
        printf("Your order is:\n");
        printf("%d,:Burgers,  %d, Plain Burgers,  %d,Cheeseburgers,  %d, Ketchup Burgers\n\n",(menuarray[0]+menuarray[1]+menuarray[2]),menuarray[0],menuarray[1],menuarray[2]);
        printf("%d,:VegiBurgers,  %d, Plain VegiBurgers,  %d, Cheese Vegiburgers,  %d, Ketchup VegiBurgers\n",(menuarray[3]+menuarray[4]+menuarray[5]),menuarray[3],menuarray[4],menuarray[5]);
        printf("%d,:Chicken,  %d, Piri Piri Chicken,  %d, Spicy Chicken,  %d, Mild Chicken\n\n",(menuarray[6]+menuarray[7]+menuarray[8]),menuarray[6],menuarray[7],menuarray[8]);
        printf("%d,:kids meal,  %d, kids meal- Sausage and chips ,  %d, kids meal - fishfingers and chips,  %d, kids meal- Chicken nuggets and chips\n\n",(menuarray[9]+menuarray[10]+menuarray[11]),menuarray[9],menuarray[10],menuarray[11]);
        printf("%d,:Fish,  %d, Cod,  %d, Haddock,  %d, Scampi\n\n",(menuarray[12]+menuarray[13]+menuarray[14]),menuarray[12],menuarray[13],menuarray[14]);
        printf("%d,:Salads,  %d, Bean Salad,  %d, Caesar Salad,  %d, Garden Salad\n\n",(menuarray[15]+menuarray[16]+menuarray[17]),menuarray[15],menuarray[16],menuarray[17);
        
    }

  12. #12
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Yeah, that's better. An even better approach is to have different arrays for different categories( Burgers, VegiBurgers, etc ) but it's ok.
    Devoted my life to programming...

  13. #13
    Registered User
    Join Date
    Nov 2011
    Posts
    12
    thanks for your help with that GReaper, from my message above do you have an indication as to where I have gone wrong with my code? the int menu_function doesn't work at all, when i enter the case value it doesent load it, it continues in a loop and then prints the results,( all results are 0, because they were initialized in the array)

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    void printorder_function();
    int menu_function();
    int x;
    int menuarray[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    int sentinel = 20;
    
    
    int main()
    {
        int x;
        printf("press 1 for Plain Burger\n");
        printf("press 2 for Cheese Burger\n");
        printf("press 3 for Ketchup Burger\n");
        printf("press 4 for Plain VegiBurger\n");
        printf("press 5 for Cheese VegiBurger\n");
        printf("press 6 for Ketchup VegiBurger\n");
        printf("press 7 for Piri Piri Chicken Meal\n");
        printf("press 8 for Spicy Chicken Meal\n");
        printf("press 9 for Mild Chicken Meal\n");
        printf("press 10 for Kids Meal - Sausage and Chips\n");
        printf("press 11 for Kids Meal - Fishfingers and Chips \n");
        printf("press 12 for Kids Meal - Chicken Nuggets and Chips \n");
        printf("press 13 for Cod\n");
        printf("press 14 for Haddock\n");
        printf("press 15 for Scampi\n");
        printf("press 16 for Bean Salad\n");
        printf("press 17 for Caesar Salad\n");
        printf("press 18 for Garden Salad\n");
        printf("press 19 for When finished\n");
        printf("press 20 to restart\n");
    
    
        menu_function();
        printorder_function();
        
        return 0;
    }
    
    
    int menu_function(int x)
    
    
    {
        
        while(x!=sentinel)
        {
        printf("enter your choice: ");
        scanf("%d\n",&x);
        
        switch(menuarray[x])
            
        {
        case '1': printf("how many plain burgers would you like?: ");
                    scanf("%d\n", &menuarray[0]); break;
        
        case '2': printf("how many cheese burgers would you like?: ");
                    scanf("%d\n", &menuarray[1]); break;
    
    
        case '3': printf("how many ketchup burgers would you like?: ");
                    scanf("%d\n", &menuarray[2]); break;
        
        case '4': printf("how many plain Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[3]); break;
    
    
        case '5': printf("how many Cheese Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[4]); break;
        
        case '6': printf("how many Ketchup Vegiburgers would you like?: ");
                    scanf("%d\n", &menuarray[5]); break;
    
    
        case '7': printf("how many Piri Piri Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[6]); break;
        
        case '8': printf("how many Spicy Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[7]); break;
    
    
        case '9': printf("how many Mild Chicken Meals would you like?: ");
                    scanf("%d\n", &menuarray[8]); break;
        
        case '10': printf("how many Kids Meal Sausage and Chips would you like?: ");
                    scanf("%d\n", &menuarray[9]); break;
    
    
        case '11': printf("how many Kids Meal Fishfingers and Chips would you like?: ");
                    scanf("%d\n", &menuarray[10]); break;
    
    
        case '12': printf("how many Kids Meal Chicken Nuggets and Chips would you like?: ");
                    scanf("%d\n", &menuarray[11]); break;
        
        case '13': printf("how many cod meals would you like?: ");
                    scanf("%d\n", &menuarray[12]); break;
    
    
        case '14': printf("how many haddock meals would you like?: ");
                    scanf("%d\n", &menuarray[13]); break;
        
        case '15': printf("how many scampi meals would you like?: ");
                    scanf("%d\n", &menuarray[14]); break;
    
    
        case '16': printf("how many bean salads would you like?: ");
                    scanf("%d\n", &menuarray[15]); break;
    
    
        case '17': printf("how many caesar Salads would you like?: ");
                    scanf("%d\n", &menuarray[16]); break;
        
        case '18': printf("how many garden salads would you like?: ");
                    scanf("%d\n", &menuarray[17]); break;
    
    
        case '19': printorder_function(); break;
            
        case '20': system("cls");
                      main();
        
        /*default: printf("Error, please enter valid characters\n");break; */
    }
        }
    return 0;
    }
    
    
    void printorder_function()
    {
        system("cls");
        printf("Your order is:\n");
        printf(" %d,:Burgers\n %d, Plain Burgers\n %d,Cheeseburgers\n %d, Ketchup Burgers\n\n",(menuarray[0]+menuarray[1]+menuarray[2]),menuarray[0],menuarray[1],menuarray[2]);
        printf(" %d,:VegiBurgers\n %d, Plain VegiBurgers\n %d, Cheese Vegiburgers\n %d, Ketchup VegiBurgers\n\n",(menuarray[3]+menuarray[4]+menuarray[5]),menuarray[3],menuarray[4],menuarray[5]);
        printf(" %d,:Chicken\n %d, Piri Piri Chicken\n %d, Spicy Chicken\n %d, Mild Chicken\n\n",(menuarray[6]+menuarray[7]+menuarray[8]),menuarray[6],menuarray[7],menuarray[8]);
        printf(" %d,:kids meal\n %d, kids meal- Sausage and chips\n %d, kids meal - fishfingers and chips\n %d, kids meal- Chicken nuggets and chips\n\n",(menuarray[9]+menuarray[10]+menuarray[11]),menuarray[9],menuarray[10],menuarray[11]);
        printf(" %d,:Fish\n %d, Cod\n %d, Haddock\n %d, Scampi\n\n",(menuarray[12]+menuarray[13]+menuarray[14]),menuarray[12],menuarray[13],menuarray[14]);
        printf(" %d,:Salads\n %d, Bean Salad\n %d, Caesar Salad\n %d, Garden Salad\n\n",(menuarray[15]+menuarray[16]+menuarray[17]),menuarray[15],menuarray[16],menuarray[17]);
        
    }

  14. #14
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    "switch(menuarray[x])" should really be "switch (x)".
    Devoted my life to programming...

  15. #15
    Registered User
    Join Date
    Nov 2011
    Posts
    12
    thanksm ive changed that, but it is still not performing the switch, any other ideas/comments?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a C menu using Up Down
    By RockLee in forum C Programming
    Replies: 7
    Last Post: 03-15-2011, 06:02 PM
  2. creating menu
    By spikestar in forum C Programming
    Replies: 3
    Last Post: 09-19-2009, 11:16 PM
  3. Creating a menu system
    By ICool in forum C Programming
    Replies: 9
    Last Post: 09-17-2007, 12:18 PM
  4. What I've got so far, creating a menu system:
    By Shamino in forum Game Programming
    Replies: 4
    Last Post: 06-15-2007, 03:03 AM
  5. creating a menu using C
    By whitey82 in forum C Programming
    Replies: 11
    Last Post: 12-01-2005, 12:43 PM