Hello there. Before I start, I'm not a professional programmer, its just my hobby and I'm programming in C, but here are my suggestions how to start:
1. Your program seems to be a task for some parser/lexical analyzer like Lex and Yacc (FLEX & BISON) and other stuff like this.
I was trying to learn Lexx and Yaxx, but its a bit complicated for someone who does not have experiences with it and so I quit. But I will return to it somedays, because its a powerful tool for parsing and this kind of stuff and it comes in handy in such cases.
In case you really want to program it by yourself in C++ here is how I would proceed:
1: Open the file and read it into a buffer
2: Read the buffer word by word (tokenize it) and compare the word to some predefined library which you need to create on the first place.
0: Create a buffer of words related to numbers (your text numbers library) like:
char *digits[] = {"zero", "one", "two", "three"...};
char *tenths[] = {"twenty", "thirty", "forty"....}
and other words like:
char *rest[] = {"hundred", "thousand", "million", ....}
Now lets return to our second point. After you get the token back from the file (you can use strtok() function to get the tokens), you can compare the word with words from your library.
The comparison is the most complex task. You have to decide somehow, if its a single digit or a number like 125255, which would be in text something like:
"one hundred and twentyfive thousands two hundred and fiftyfive"
or something like that.
You need to recognize, if its a complex number like this which is in general a single number or if these are 6 different numbers. So you need to create a scheme like:
Check the word.
Is it a number? Yes -> now decide, how to proceed -> Check if its a hundred, thousand, million or so. Is it? Yes, then we assume, that is a complex number, and you have to count the "one" and "hundred" as 1 number. This is actually called a gramatic (used in YACC and so). According to this you distinguish between different cases and decide, what to do. In your case "just" decide, if its a complex or simple nubmer and increase your variable.
Hopefully you'll find this useful for a starter. :-)