Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100126 | 郝王骏程 | 字符串中最大的数字 | C++ | Compile Error | 0 MS | 0 KB | 337 | 2024-12-02 20:59:44 |
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ string n; cin >> n; char m = '0'; for (int i = s; i < n.length(); i++) { if (n[i] >= '0' && n[i] <= '9') { m = max(m, n[i]); } } cout << m << endl; return 0; }
Main.cc: In function 'int main()': Main.cc:9:17: error: 's' was not declared in this scope for (int i = s; i < n.length(); i++) { ^ Main.cc:9:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = s; i < n.length(); i++) { ^