Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
153346 陈骏睿 二进制转十进制 C++ Compile Error 0 MS 0 KB 424 2026-05-16 11:13:19

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(){ char a[64]={}; cin>>a; int l=strlen(a),n=0; for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){ n=a[j]-'0'*pow(2,i); } cout<<n<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:17: error: expected unqualified-id before 'int'
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
                 ^
Main.cc:11:17: error: expected ';' before 'int'
Main.cc:11:26: warning: for increment expression has no effect [-Wunused-value]
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
                          ^
Main.cc:11:29: error: expected ')' before ';' token
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
                             ^
Main.cc:11:11: warning: unused variable 'j' [-Wunused-variable]
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
           ^
Main.cc:11:30: error: 'j' was not declared in this scope
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
                              ^
Main.cc:11:35: error: 'i' was not declared in this scope
   for(int j=l-1,int i=1;i<=l;j>=0;i++;j--){
                                   ^