Well, create an associated container such as
std::map
(
http://en.wikipedia.org/wiki/Map_%28C%2B%2B%29[
^]) to find digits by their names. The words like "one", "two"… will play the role of the keys, the digits will be found as characters, so you will need
std::map<std::string, char>
. Use member function
find
to find a digit by a recognized word from your grammar; if the digits is not found, so something else; consider a word as a operation, identifier, etc.
—SA