#include<iostream>
#include<string>
using namespace std;
int main()
{
string greetString("Hello std::string!");
cout << greetString << endl;
cout << "Enter a line of text:" << endl;
string firstLine;
getline(cin,firstLine);
cout << "enter another: " << endl;
string secondLine;
getline(cin,secondLine);
cout << "Result of concatenation:" << endl;
string concatString = firstLine + secondLine;
cout << concatString << endl;
cout << "copy of concatenated string:" << endl;
string aCopy;
aCopy = concatString;
cout << aCopy << endl;
return 0;
}
C++语言之“标准字符串 std::string”
最新推荐文章于 2024-03-24 17:34:48 发布