| 3 | #include <string> |
| 4 | |
| 5 | int main() |
| 6 | { |
| 7 | std::string sentence {"Manners maketh man"}; |
| 8 | std::string word {"man"}; |
| 9 | std::cout << sentence.find(word) << std::endl; // Outputs 15 |
| 10 | std::cout << sentence.find("Ma") << std::endl; // Outputs 0 |
| 11 | std::cout << sentence.find('k') << std::endl; // Outputs 10 |
| 12 | std::cout << sentence.find('x') << std::endl; // Outputs std::string::npos |
| 13 | } |