std::string str1 = "Hello"; std::string str2 = "World"; if(str1 == str2) { std::cout << "Strings are equal"; } else { std::cout << "Strings are not equal"; }
std::string str3 = "Hello"; std::string str4 = "Hello"; if(str3 == str4) { std::cout << "Strings are equal"; } else { std::cout << "Strings are not equal"; }In this example, the program will output "Strings are equal" because str3 and str4 have the same value. Package library: The String equals function is part of the standard C++ library and is included in the