Start with
std::map<std::string, Commands> table;
Then add your translation information, like table["model"] = MODEL;
Then you can have say
std::string command = "model"; // or as read from the file
switch ( table[command] ) {
case MODEL: // and so on
}
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Only problem is I can't use maps or any of that fancy jazz.
tutorial
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
> I can't use maps or any of that fancy jazz.
"can't" as in you haven't even tried to learn how to use them.
"can't" as in it is outside the scope of your homework assignment.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
So write your own function which takes a string containing the model, then returns an enum.
A simple if / else if chain ought to do it.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953