ok so basically what im wanting to do is setup functions and call on them later...
this is kind of what i want

void mainmenu(){
//what i want in there...
//if statements etc

}
void etc()
{
//whatever goes here}
int main() // and then have them get called on here
{
void mainmenu();
void etc();// and then is there a way where i can do it where as i go through my script and have if statements etc it dosnt keep showing it, like after i have a if statement and then have another one, when they do the second if statement the first would stop showing up

}

what im doing this for is basically information, just a simple interactive information script where it has a menu, you select what you want, it moves to the next menu and etc etc
i know how to do everything BUT do the functions as stated up ^^ and also make it so when you move from say, the main menu to etc, it stops showing the main menu and starts it at etc.

thanks for the help please post etc... xD

Recommended Answers

All 3 Replies

void mainmenu()
{
  //If you want to exit prematurely, use return;

  if(true)
    return;
}
void etc()
{
}
int main()
{
//When calling a function, do as such:
   mainmenu();
   etc();

   return 0;
}

I have no idea what you want. The answer as I understand the question is "don't call the function until you want it." But since that's obvious, that can't be what you're asking.

Steps:-

0) Set current menu to main menu
1) Show current menu
2) Get user input
3) Hide current menu
4) Use user input to decide which sub menu to show
5) Set current menu to sub menu
6) Repeat streps 1 to 6 until exit

Does this makes any sense to you???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.