This is not specific to C++ Builder but…
You could count the spaces with instr (actually I can't remember if it is this function) and add 1
"just like this" 2 spaces 3 words
There would be a problem with double spaces so you would have to have a temporary variable that stored the last character. If the current char is a space it checks the variable to see if the last char was a space, if so the count is not incremented.
You would also have to remove any beginning and ending spaces from the string you are ‘word counting’.
Then there is the thinking about what you want to include in your word count, would you want the following to be words, ‘3rd’ ‘&’. For simplicity I would say anything with a space either side of it is a word.
I suppose its more complicated than at a first glance.
EDIT: Looking at the way word does its word count, it includes as I said anything with a space either side of it is. e.g. " ^^^ "