STANAANDREY

24/9/2019 pb1/66

Sep 24th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char s[100];
  9.     unsigned n, i, nr = 1;
  10.     gets(s);
  11.     n = strlen(s);
  12.     for (i = 0; i < n; i++)
  13.         if ((s[i] == ' ' || s[i] == '.' || s[i] == ',') && s[i+1])
  14.             nr++;
  15.     cout << "textul are " << nr << " cuvinte.";
  16.     return 0;
  17. }
Add Comment
Please, Sign In to add comment