Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
128635 林嘉乐 十进制转二进制 C++ Compile Error 0 MS 0 KB 493 2025-08-18 17:15:32

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n; cin>>a; int a[64]={}; int i=0; int l=strlen(a); 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:9:10: error: 'a' was not declared in this scope
     cin>>a;
          ^
Main.cc:12:9: warning: unused variable 'l' [-Wunused-variable]
     int l=strlen(a);
         ^