Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DarkSephiroth

workin on first C++ project but i need minor help...

This topic is 5626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, im making a main menu right and for some reason, the switch isnt working, can someone help me out... void Menu() { int choice = 0; ....Stuff here.... cout << "Please Choose: "; cin >> choice; switch(choice) { case ''1'': NewPlayer(); break; case ''2'': cout << "LoadGame() function is not done...\n"; break; case ''3'': cout << "SimpleRPG in C++ made by DarkSephiroth.\n"; break; case ''4'': cout << "Thanks for trying....\n"; break; default: cout << "Not Valid...\n"; break; } }

Share this post


Link to post
Share on other sites
Advertisement
template
__________


switch(name)
{
case 1:
cout << "yay";
break;
case 2:
cout << "mmm";
break;
default:
cout << "bummer";
}



Your welcome...GODD

Now go comment on my thread, its nearby yours

Share this post


Link to post
Share on other sites
quote:

case ''1'':
NewPlayer();
break;
case ''2'':
cout << "LoadGame() function is not
.....................
}


Choice is an int so you don''t need the single quotes around the case operands.

Use:
case 1

instead of

case ''1''.

OR

You chould change choice to char.



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!