Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122552 袁星皓 二进制转十进制 C++ Compile Error 0 MS 0 KB 254 2025-06-21 11:12:43

Tests(0/0):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ char a[64]; cin>>a; int len=strlen(a); int sum; for(int i=0,j=len-1;i<len,j>=0;i++,j--){ sum+=((a[j]-'0')*pow(2,i)); } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:26: warning: left operand of comma operator has no effect [-Wunused-value]
     for(int i=0,j=len-1;i=0;i++,j--){
                          ^
Main.cc:10:30: error: 'pow' was not declared in this scope
      sum+=((a[j]-'0')*pow(2,i));
                              ^