#include <iostream>
usingnamespace std;
int findWord(char *str, int size);
int main()
{
char str[100];
cout << "Enter a sentence: " << endl;
cin >> str;
int words = findWord(str, 99);
cout << "There are " << words << " words in the sentence " << endl;
return 0;
}
int findWord(char *str, int size)
{
int count = 0;
while (*str)
{
if (*str == ' ')
count++;
}
return count;
}