Advertisement
VictoriaLodochkina

lab 4 z1

Mar 11th, 2020
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string text, word;
  9.     char symbol;
  10.     cout << "Enter symbol: " << endl;
  11.     cin >> symbol;
  12.     cin.ignore(100, '\n');
  13.     cout << "Enter text: " << endl;
  14.     getline(cin, text);
  15.     stringstream words(text);
  16.     while (words >> word)
  17.     {
  18.         if (word.find(symbol) != string::npos)
  19.         {
  20.             cout << word << endl;
  21.         }
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement