字符串可以 按数组格式输出单字符
作者:互联网
#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
请按任意键继续. . .
标签:--------------------------------,字符,ch,cout,int,char,任意键,字符串,格式 来源: https://www.cnblogs.com/q1231/p/15960688.html