include<iostream> using namespace std;int main(){ int character(char *a);char a[20];int length;cout<<"请输入一个字符串:"<<endl;cin>>a;length=character(a);cout<<"字符串长度为:"<<length<<endl;return 0;}
include "stdio.h"include "string.h"int stringlength( char *str ){ return strlen( str );} int main(){ char str[100];int len;printf("Please input a string: ");scanf("%s",str);len = stringlength( str );printf("The string's length is %d.\n",len);return 0;} ...
include<iostream> using namespace std;int main(){ int character(char *a);char a[20];int length;cout<<"请输入一个字符串:"<<endl;cin>>a;length=character(a);cout<<"字符串长度为:"<<length<<endl;return 0;}