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

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:13: error: expected identifier before 'a'
  int q[10]=['a','b','c','d','e','f'];
             ^
Main.cc:10:16: error: expected ']' before ',' token
  int q[10]=['a','b','c','d','e','f'];
                ^
Main.cc: In lambda function:
Main.cc:10:16: error: expected '{' before ',' token
Main.cc: In function 'int main()':
Main.cc:10:16: error: array must be initialized with a brace-enclosed initializer
Main.cc:10:17: error: expected unqualified-id before 'b'
  int q[10]=['a','b','c','d','e','f'];
                 ^