Advertisement
_Kripaka001_

ищем слова 1(6)

Jul 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout << "you can enter 20 symbols" << endl;
  8.     char a[21];
  9.     cin.getline(a,21);
  10.     cout << "these symbols take part in the test" << endl;
  11.     cout << a << endl;
  12.  
  13.     int letters, gaps, word, b, i, m;
  14.     letters = 1;
  15.     gaps = 0 ;
  16.     word = 0;
  17.     b = 1;
  18.     a[21] = 0;
  19.  
  20.     while ( b < 21)
  21.     {
  22.         if ( a[b] != ' ')
  23.             {
  24.                 while (a[b] != ' ')
  25.                 {
  26.                     letters++;
  27.  
  28.  
  29.  
  30.                 }
  31.                 word++;
  32.             }
  33.  
  34.         else
  35.             {
  36.                 while (a[b] = ' ' )
  37.                 {
  38.                     gaps++;
  39.  
  40.  
  41.                 }
  42.             }
  43.             b++;
  44.     }
  45.  
  46.  
  47.  
  48.  
  49.     cout << "these symbols have   " <<  word  ;
  50.     cout << "  words";
  51.     cout << endl << letters;
  52.     cout << "letters" << endl;
  53.     cout << gaps << "  gaps";
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement