71 - string Class and string Fun
2018-01-10 本文已影响0人
社交帐号直接注册
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1("hampster ");
string s2;
string s3;
s2 = s1;
s3.assign(s1);
cout << s1 << s2 << s3 << endl;
string s4 = "cvbnm";
cout << s4.at(3) << endl;
for(int x=0;x<s4.length();x++)
{
cout << s4.at(x);
}
}