Advertisement
Guest User

Сколько слов в строке

a guest
Jan 23rd, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int e = 0;
  8.     int probel = 0;
  9.     char a[100];
  10.     cout << "vvedi chto nibud";
  11.     cout << endl;
  12.     cin.getline(a, 100);
  13.     while ( e < 100 )
  14.     {
  15.         if ( a[e] == 32 )
  16.         {
  17.             probel++;
  18.         }
  19.         e++;
  20.     }
  21.     probel++;
  22.     cout << probel << " words";
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement