原型:strlen( const char string[] );
功能:统计字符串string中字符的个数
例程:
#include <iostream.h>
#include <string.h>
void main(void)
{
char str[100];
cout <<"请输入一个字符串:";
cin >>str;
cout <<"The length of the string is :"<<strlen(str)<<"个"<<endl;
}
运行结果The length of the string is x (x为你输入的字符总数字)
注意:strlen函数的功能是计算字符串的实际长度,不包括'
