字符串可以 按数组格式输出单字符


#include <bits/stdc++.h>
using namespace std;

int main(){
string str = "asd";
char *ch ="cc11";
cout<<str[1]<<endl;
cout<<ch[2]<<endl;

cout<<str.size()<<endl;
}
s
1

3

--------------------------------
Process exited after 0.05146 seconds with return value 0
请按任意键继续. . .

上一篇:a^b


下一篇:P4753 River Jumping