#include using namespace std; int main() { string greeting = "Hello"; cout << greeting << endl; string firstName = "John"; string lastName = "Doe"; string fullName = firstName + " " + lastName; cout << fullName << endl; fullName = firstName.append(" ").append(lastName); cout << fullName << endl; cout << "The length of the txt string is: " << fullName.length() << endl; // 竖着打印 for (int i = 0; i < fullName.length(); i++) { cout << fullName[i] << endl; } // 转义字符 cout << "We are the so-called \"Vikings\" from the north." << endl; }