Advertisement
Guest User

Untitled

a guest
May 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <clocale>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     setlocale(LC_ALL, "Rus");
  9.     string str;
  10.     int n = 0;
  11.     cout << "Введите слова: ";
  12.     for (;;) {
  13.         cin >> str;
  14.         int end = str.find("done", 0);
  15.         if (end != string::npos) break;
  16.         else n++;
  17.     }
  18.     cout << endl << "До ключевого слова было " << n << " слов" << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement