I am currently defining some constants:
struct ModInfo {
int numChoices;
string menu;
ModInfo (int count, string menuText) : numChoices(count), menu(menuText) {
}
};
const ModInfo menus[4] = {ModInfo(3, "..."), ModInfo(7, "...", ...};
Each ModInfo
contains the information for a module that will be used by main()
in printing menus to the display and flow control to determine which module's menu to print and which function in it to subsequently execute.
Instead of accessing a module's info inside an array element via array index, can I assign an identifier (ie. the module's name) to that element instead? Is there a direct way to do this, or is enum
the only hack to do this?
Edit: Please stop asking me to use C++11 in every question I ask. I would if I could.