Sign in to follow this  
ms75214

overall structure

Recommended Posts

Is this a good overall structure for a game? Or not so much?

[code]

enum game_menu_choice {PLAYGAME, INSTRUCTIONS, EXIT};

int main(void)
{

do {

game_menu_choice user_choice = get_user_choice();

switch(user_choice)
{
case PLAYGAME:
Playgame();
break;

case INSTRUCTIONS:
Show_Instructions();
break;

case EXIT();
exit(0);
break;


};


} while(1);







}

[/code]

Share this post


Link to post
Share on other sites
Looks like a good start. I would probably use a while(true) loop rather than the less common do { ... } while loop, and I'd also return from main rather than calling exit(), but these are minor stylistic issues.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this