Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
177 | Benson | 十进制转二进制 | C++ | Compile Error | 0 MS | 0 KB | 301 | 2022-07-21 10:56:02 |
#include<iostream> #include<cstring> #include<cmath> using namespace std; int main() { string b; int i=0,y,a; cin>>a; while(a!=0) { if(k==0) { cout<<0; } y=a%2; b[i]=y+'0'; a=a/2; i++; } for(i;i>=0;i--) { cout<<b[i-1]; } return 0; }
Main.cc: In function 'int main()': Main.cc:12:9: error: 'k' was not declared in this scope if(k==0) ^ Main.cc:21:7: warning: statement has no effect [-Wunused-value] for(i;i>=0;i--) ^