//用string类型的字符串连接两个字符串。
//string比c风格好用!因为C++封装了字符串,把字符串的所有操作封装在string类中
#include<iostream>
#include<string>
using namespace std;
int main()
{
const string str1("I am a hardwork ");
cout<<str1<<endl;
const string str2("student");
cout<<str2<<endl;
string result_str=str1;
result_str+=str2;
cout<<result_str<<endl;
return 0;
}
//string比c风格好用!因为C++封装了字符串,把字符串的所有操作封装在string类中
#include<iostream>
#include<string>
using namespace std;
int main()
{
const string str1("I am a hardwork ");
cout<<str1<<endl;
const string str2("student");
cout<<str2<<endl;
string result_str=str1;
result_str+=str2;
cout<<result_str<<endl;
return 0;
}