getline(cin,str);录入储存到str,不包括换行,但也不留下换行(消耗掉了)
.size()返回类型为 string::size_type
expression that have int and size_type ,if int is negative,it will convert to a large unsigned value and yield an unexpected value(using unsigned type to avoid the problem)
字符一样看长度不一样看第一个不一样的大小。
one of +operator’s two operand must have a string(满足依次结合传递)
string a="dd"+",";//wrong
string b,c=b+"dd"+",";//ture
the difference between header for .h and header leading with c is c name header are defined inside std namespace.
string a("dsadsad");
for(auto n: a)
cout<<n<<endl;//最后的空字符也会输出
对空str取下标结果是undefined
for(auto &n:a)
n=toupper(n);//这种用法来改变a中字符