Since these integers could be in the same word as regular characters (like 10th), and if you don't know where or what they will be, I would search one character at a time for a digit (see isdigit), and then make a new string with that digit and each following one until a non-digit is found. You can then convert that new string to an int using your favorite conversion tool - stringstreams, lexical_cast, atoi.