Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
146638 李折曦 字符串中最大的数字 C++ Compile Error 0 MS 0 KB 220 2026-01-29 14:38:54

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int main (){ char n[12]; cin>>n; int m=a[0]-'0'; int n=strlen(a); while(n[i]!='\0'){ if(n[i]-'0'>m)m=n[i]-'0'; i++; } cout<<m<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:8: error: 'a' was not declared in this scope
  int m=a[0]-'0';
        ^
Main.cc:7:6: error: conflicting declaration 'int n'
  int n=strlen(a);
      ^
Main.cc:4:7: note: previous declaration as 'char n [12]'
  char n[12];
       ^
Main.cc:8:10: error: 'i' was not declared in this scope
  while(n[i]!='\0'){
          ^