| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 128643 | 林嘉乐 | 十进制小数转二进制 | C++ | Compile Error | 0 MS | 0 KB | 626 | 2025-08-18 17:27:31 |
#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(){ double x; cin>>x; int a[64]={}; int i=0; int n=x; double m=x-n; if(n==0)cout<<'0';; while(n!=0){ a[i]=n%2; n/=2; i++; } for(int j=i-1;j>=0;j--){ cout<<a[j]; } if(m!=0){ cout<<'.'; while(m!=0){ m=m*2; cout<<(int)y; y=y-((int)y; } } cout<<endl; return 0; }
Main.cc: In function 'int main()':
Main.cc:29:17: error: 'y' was not declared in this scope
cout<<(int)y;
^
Main.cc:30:17: error: expected ')' before ';' token
y=y-((int)y;
^