std::string s = "hello"; s.push_back('!'); // string s is now "hello!"
std::string s = "world"; const char* additionalChars = " is beautiful"; for (size_t i = 0; i < strlen(additionalChars); i++) { s.push_back(additionalChars[i]); } // string s is now "world is beautiful"This example adds the additional characters in the const char* array to the end of the string. The std::string::push_back function is part of the C++ standard library.