switch,case,arrays and functions being used together!

hello! i am a beginner in c++ programming and am having problem in using case statement and switch together with arrays being passed to functions. can you please write a really SIMPLE program in which all these things are being used together. and one more thing. Please tell me how to design menus in which the next menu starts on a new page.
you can make the menus in functions like this:

1
2
3
4
5
6
7
8
9
int menu1()
{
    int choice = 0;
    std::cout<<"start menu here"<<std::endl;//presents the menu
    std::cin>>choice; // used to type the choice

   return choice; // returns the choice where you called the function

}


And the call them from the main part or other functions by typing

 
int myMenuChoice = menu1(); // the int variable gets the value returned from the function and //you can use it in your switch case :) 


Simple switch case

1
2
3
4
5
6
7
8
9
10
int c = 0;
switch(c)
{
case 1:
//code
break;
case 2:
//code
break;
}


hope it helped
Topic archived. No new replies allowed.