#includeusing namespace std; int main() { string str = "Hello World"; return 0; }
#includeIn the above code example, we perform three operations on strings: concatenation, comparison, and substitution. We concatenate two strings using the `+` operator, compare two strings using the `==` operator, and substitute a character in a string using the `replace()` function. The `string` class is a part of the C++ Standard Library. Package library: `#include using namespace std; int main() { string str1 = "Hello "; string str2 = "World"; string str3 = str1 + str2; cout << str3 << endl; bool result = (str1 == str2); cout << result << endl; str2.replace(0, 1, "w"); cout << str2 << endl; return 0; }