#include <iostream> #include <string> using namespace std; int main() { int n(20); cout << n << endl; string a = "dog"; string b =a + ", cat"; cout << b << endl; string c = a + "dog" + "cat"; cout << c << endl; //string d = "dog" + "cat"; //错误!!! return 0; }
运行结果:
20 dog, cat dogdogcat