Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int count_words(string text)
- {
- int words = 0;
- int l = strlen(text);
- for (int j = 0; j < l; j++)
- {
- if (isspace(text[j]) != 0)
- {
- words++;
- }
- }
- if (l >= 1)
- {
- words += 1;
- }
- return words;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement