I don't think scanf/fscanf will do what you need in this case if you don't know the exact format of the input string.
A better approach might be to parse the input line until you hit a whitespace, period, or comma (or some other separator), and then see if what you have so far consists solely of digits. If so, then you have a number, otherwise, you have a word (assuming here the sentence is well formed). You could then store that number in an array or whatever data structure you desire.
However, if the sentence structure is always in exactly the same format, you could use an approach like this:
int main() {
char* buff = "In this document, there are 345 words and 6 figures";
char extra1[5000];
char extra2[5000];
int a,b;
sscanf(buff,"%[In this document, there are ]%d%[ words and ]%d", extra1, &a, extra2, &b);
cout<<a<<" "<<b<<endl;
return 0;
}