| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 154547 | 田子熙 | 指针遍历字符串 | C++ | Compile Error | 0 MS | 0 KB | 243 | 2026-05-30 16:45:00 |
#include<bits/stdc++.h> using namespace std; int main(){ string a; cin>>a; int s=0; int l=strlen(c); char b=a[l-1]; char *p=c; for(int i=0;i<a.length();i++){ if(*p==b){ s++; } p++; } cout<<s; return 0; }
Main.cc: In function 'int main()':
Main.cc:7:15: error: 'c' was not declared in this scope
int l=strlen(c);
^
Main.cc:10:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i