Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
70125 刘浩宇 十进制转R进制 C++ Compile Error 0 MS 0 KB 321 2024-04-13 17:14:04

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n; if(n==0){ cout<<0; return 0; } int a[32]={0}; int q[10]=[a,b,c,d,e,f]; int cnt=0; while (n!=0){ a[cnt++]=n%16; if (a[cnt]>9){ a[cnt]=q[n%16-9]; } n/=16; } for(int i=cnt-1;i>=0;i--){ cout<<a[i]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:15: error: 'b' was not declared in this scope
  int q[10]=[a,b,c,d,e,f];
               ^
Main.cc:10:17: error: 'c' was not declared in this scope
  int q[10]=[a,b,c,d,e,f];
                 ^
Main.cc:10:19: error: 'd' was not declared in this scope
  int q[10]=[a,b,c,d,e,f];
                   ^
Main.cc:10:21: error: 'e' was not declared in this scope
  int q[10]=[a,b,c,d,e,f];
                     ^
Main.cc:10:23: error: 'f' was not declared in this scope
  int q[10]=[a,b,c,d,e,f];
                       ^
Main.cc: In lambda function:
Main.cc:10:25: error: expected '{' before ';' token
  int q[10]=[a,b,c,d,e,f];
                         ^
Main.cc: In function 'int main()':
Main.cc:10:25: error: array must be initialized with a brace-enclosed initializer