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

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(){ doubre s=0; doubre q=1; char a[64]; cin>>a; int l=strlen(a); int i=0; while(a[i]!='.'&&i<l)i++; for(int j=i-1;j>=0;j--){ s+=(p*a[j]-'0'); p*=2; } p=2; for(i+=1;j<l;i++){ s+=((1/p)*(a[i]-'0')); p*=2; } cout<<s; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:5: error: 'doubre' was not declared in this scope
     doubre s=0;
     ^
Main.cc:9:12: error: expected ';' before 'q'
     doubre q=1;
            ^
Main.cc:16:6: error: 's' was not declared in this scope
      s+=(p*a[j]-'0');
      ^
Main.cc:16:10: error: 'p' was not declared in this scope
      s+=(p*a[j]-'0');
          ^
Main.cc:19:5: error: 'p' was not declared in this scope
     p=2;
     ^
Main.cc:20:14: error: 'j' was not declared in this scope
     for(i+=1;j