#include#include int main() { std::string str = "Hello World"; if(str.contains("World")) std::cout << "Substring found"; else std::cout << "Substring not found"; return 0; }
#includeOutput: Substring not found The string contains() function is a part of the C++ standard library.#include int main() { std::string str = "Today is a beautiful day"; if(str.contains("good")) std::cout << "Substring found"; else std::cout << "Substring not found"; return 0; }