fork download
  1. #include <string>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main(){
  8. string text = "Hello world", findText = "world";
  9. cout << text << endl;
  10. text = "world is hell";
  11. cout << text << endl;
  12.  
  13. if(text.find(findText) != string::npos){
  14. cout << "find true" << endl;
  15. }
  16. vector <string> vec = {
  17. "world",
  18. "Text",
  19. "test"
  20. };
  21. findText = "test";
  22. auto it = find(vec.begin(), vec.end(), findText);
  23. if(it != vec.end()){
  24. cout << "test find" << endl;
  25. }
  26. cout << "////////////////////////////////////////" << endl;
  27. vec.push_back("privet");
  28. for(auto &var : vec){
  29. cout << var << endl;
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 4232KB
stdin
Standard input is empty
stdout
Hello world
world is hell
find true
test find
////////////////////////////////////////
world
Text
test
privet