1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/*编写一个函数Strlen(char *s)求s字符串的长度并进行测试。*/
#include <iostream>
using
namespace
std;
int
Strlen(
char
*str)
{
int
len=0;
while
(*(str+len)!=
'\0'
)
{
len++;
}
return
len;
}
int
main()
{
cout<<
"zhang的字符个数为"
<<Strlen(
"zhang"
)<<endl;
}
|