| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 135896 | 林嘉乐 | 利用指针编写strlen函数 | C++ | Compile Error | 0 MS | 0 KB | 292 | 2025-11-08 17:02:20 |
#include<bits/stdc++.h> using namespace std; int slen(char *p){#include<bits/stdc++.h> using namespace std; int slen(char *p){ int i,n=0; while(*p!='\0'){ n++; p++; } return n; } int main(){ int a[1001]; cin>>a; cout<<slen(a)<<endl; return 0;
Main.cc:3:19: error: stray '#' in program
int slen(char *p){#include
^
Main.cc: In function 'int slen(char*)':
Main.cc:3:20: error: 'include' was not declared in this scope
int slen(char *p){#include
^
Main.cc:3:28: error: 'bits' was not declared in this scope
int slen(char *p){#include
^
Main.cc:3:33: error: 'stdc' was not declared in this scope
int slen(char *p){#include
^
Main.cc:4:1: error: expected primary-expression before 'using'
using namespace std;
^
Main.cc:5:18: error: a function-definition is not allowed here before '{' token
int slen(char *p){
^
Main.cc:19:13: error: expected '}' at end of input
return 0;
^
Main.cc:19:13: warning: no return statement in function returning non-void [-Wreturn-type]