This is a standard header file that contains a couple of functions that you will find useful for this task. Checking for consecutive white space is as simple as checking whether the previous or the next character in the sequence is also a white space. Don't forget to check your bounds when doing this.
Secondly, if you have the time, learn how the I\O buffer works. The iostream (and maybe the string) header(s) is\are better suited for this kind of work then stdio.h is. All you should need are the extraction operator and the eof() function.
It might be better to look for letters and non-letters, rather than spaces. Then you don't have to worry about punctuation either.
Then, as you know that a word begins with the first letter after a non-letter and has ended by the first non-letter, you can (easily!) arrange to increment the word count only when you start a new word.
Ideally you would use lines 14 and 16 to create a function to use to test the chars with (there is a standard function for this purpose, isalpha(), but I assume you're not allowed to use it here if you're only allowed to use stdio.h and string.h)
But you should at least merge line 14 and 17 using ||
And as C strings are null-terminated, you don't need to use strlen to solve this problem.
PS How many words are in this sentence?
"It's a self-evident, all-inclusive cross-reference to Darwin's theory of evolution?"
@ andy: Why would you look for non-letters? A number written as 2 is still a word in the seance that it is a character or set of characters that has a meaning. Maybe this is something that the OP needs to clear up with their instructor?
The extraction operator tosses out white space for you by default whether it's consecutive or not. So you'd be counting how many times you read from std::cin until eof is reached. Now that I think about it though it would probably turn into a mess really quick since the extraction operator would leave the CRLF command in the istream.
EDIT: You can make it work but you need to also use std::cin.peek().
@ Andy: OK, I could see a scenario where if the instructor does not consider an ellipse or a number to be a word then your approach would be better; otherwise every other form of punctuation is found adjacent to a word and would be considered part of it so it wouldn't throw off the count (they're modifiers after all). It just seemed to be more complex then it needed to be at first.
EDIT: Sorry, I'm playing around with writing a grammar checker and I'm delimiting on white space, your post made me think that might have been a mistake.