字符串求长度

Kinghero King of the summit 2023-08-15 14:13:07 2023-08-15 14:14:27 0

第一种

string s;
int a = s.size()//s.length()
cout<<a;

第二种

char s[10005];
int len = 0;
while(s[len]!= '\0')
{
   len++;
}
cout<<len;

第三种

char s[10005];
cin>>s;
int len = strlen(s);
cout<<len;
{{ vote && vote.total.up }}