console menu selection
Posted on 2004-04-16
I'm trying to make a menu in c++ (dos/win32) console program that can take one or two arguments. As I understand a switch case would only take simple data structures.
First input would be a single char, while the second could be a letter, number or a name.
Based on the selection it runs the appropiate function, with name/number as argument if needed.
I would like a menu selection like this for example:
N - new player data
P A - display all players
P 23 - display player 23
P brian - display data about brian
Q - quit program
I've though about using a char array as input, and strtok somehow with alot of if else. But it will be a mess. Anyone got an example if they have done this before, or a better suggestion than strtok and if else's ?