Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- const int SIZE = 1024;
- char str[SIZE];
- int countWords = 0;
- cin.getline(str, SIZE);
- int i = 0;
- while (str) {
- if (!((str[i] <= 'z' && str[i] >= 'a') || (str[i] <= 'Z' && str[i] >= 'A'))) {
- countWords++;
- }
- do {
- i++;
- } while (!((str[i] <= 'z' && str[i] >= 'a') || (str[i] <= 'Z' && str[i] >= 'A')) && str);
- }
- cout << countWords << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement