string s1;
string s2="hello"+"world"+s1;
string s3=s1+"world"+"hello";
//s2错误,因为+左右至少有一个为string
s3正确,因为s1+"world"是一个string所以第二个+满足要求
string与字面值相加
最新推荐文章于 2024-10-27 18:28:41 发布
string s1;
string s2="hello"+"world"+s1;
string s3=s1+"world"+"hello";
//s2错误,因为+左右至少有一个为string
s3正确,因为s1+"world"是一个string所以第二个+满足要求