Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
102891 | 万隽宇 | 二进制转十进制 | C++ | Compile Error | 0 MS | 0 KB | 458 | 2024-12-26 19:08:41 |
#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 n[10]; cin>>n; int j=strlen(n),a=0; int k=j-1; for(int i=0;i<n;i++){ if(k>=0){ a+=(n[k]-'0')*pow(2.0,i); } } cout<<a; return 0; }
Main.cc: In function 'int main()': Main.cc:12:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] for(int i=0;i