| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 153354 | 陈骏睿 | 二进制小数转十进制 | C++ | Compile Error | 0 MS | 0 KB | 547 | 2026-05-16 11:55:51 |
#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(){ string a; cin>>a; int l=strlen(a); int i=0; double n=0,p=1; while(a[i]!='.'&&i<l)i++; for(int j=l-1;j>=0;,j--){ n+=(a[j]-'0')*p; p*=2; } p=2; for(i=i+1;i<l;i++){ n+=(a[1]-'0')*(1/p); p*=2; } cout<<n<<endl; return 0; }
Main.cc: In function 'int main()':
Main.cc:10:17: error: cannot convert 'std::__cxx11::string {aka std::__cxx11::basic_string}' to 'const char*' for argument '1' to 'size_t strlen(const char*)'
int l=strlen(a);
^
Main.cc:14:22: error: expected primary-expression before ',' token
for(int j=l-1;j>=0;,j--){
^