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


#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
请按任意键继续. . .

posted @ 2022-03-03 16:49  Dsad123FFFG6645  阅读(76)  评论(0)    收藏  举报