Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
188 | 关清声 | 利用指针编写strlen函数 | C++ | Accepted | 0 MS | 256 KB | 284 | 2022-07-21 18:03:27 |
#include<iostream> #include<cstring> using namespace std; int s(char *p)//定义字符指针p { int cnt=0; while(*p!='\0') { cnt++; p++; } return cnt; } int main() { char a[1000],i; cin>>a; cout<<s(a); return 0; }