2021-06-01

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

forauto &n:a)
  n=toupper(n);//这种用法来改变a中字符
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值