Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. int main() {
  2. const int SIZE = 1024;
  3. char str[SIZE];
  4. int countWords = 0;
  5.  
  6. cin.getline(str, SIZE);
  7. int i = 0;
  8. while (str) {
  9. if (!((str[i] <= 'z' && str[i] >= 'a') || (str[i] <= 'Z' && str[i] >= 'A'))) {
  10. countWords++;
  11. }
  12. do {
  13. i++;
  14. } while (!((str[i] <= 'z' && str[i] >= 'a') || (str[i] <= 'Z' && str[i] >= 'A')) && str);
  15.  
  16. }
  17. cout << countWords << endl;
  18.  
  19. system("pause");
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement