Guest User

Untitled

a guest
Jun 13th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1.                 int count = 0;
  2.         string word;
  3.         flag=true;
  4.         cout << "Введите слово: "; cin >> word;
  5.         for (int i=0; i<str.length(); i++)
  6.         {
  7.             if (str[i]==word[0])
  8.                 for(int k=i, j=0;j<word.length() || k<str.length();k++,j++)
  9.                 {
  10.                     if(str[k]!=word[j])
  11.                         flag=false;
  12.                 }
  13.                 if (flag==true)
  14.                     count++;
  15.                 flag=true;
  16.         }
  17.         cout << "Текст содержит " << count << " слов " << word <<"." << endl;
Advertisement
Add Comment
Please, Sign In to add comment