Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
128636 罗迎甲 十进制转二进制 C++ Compile Error 0 MS 0 KB 247 2025-08-18 17:15:45

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a; cin>>a; int a[64]={}; int i=0; if(n==0){ cout<<0; } while(n!=0){ a[i]=n%2; n/=2; i++; } for(int j=i-1;j>=0;j--){ cout<<a[j]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:10: error: conflicting declaration 'int a [64]'
  int a[64]={};
          ^
Main.cc:5:6: note: previous declaration as 'int a'
  int a;
      ^
Main.cc:9:5: error: 'n' was not declared in this scope
  if(n==0){
     ^
Main.cc:12:8: error: 'n' was not declared in this scope
  while(n!=0){
        ^
Main.cc:13:6: error: invalid types 'int[int]' for array subscript
   a[i]=n%2;
      ^
Main.cc:18:12: error: invalid types 'int[int]' for array subscript
   cout<