Archived

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

DarkSephiroth

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

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
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