fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. const std::string line = "I am a little test string...";
  7.  
  8. std::cout << line.find("I am") << "\n";
  9. std::cout << (line.find("I am", 1) == std::string::npos ? "not found" : "found") << "\n";
  10. std::cout << line.find("a") << "\n";
  11. std::cout << line.find("little") << "\n";
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
0
not found
2
7