Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108165 | 张黄源 | 十进制小数转二进制 | C++ | Compile Error | 0 MS | 0 KB | 306 | 2025-01-19 15:07:39 |
#include<bits/stdc++.h> using namespace std; double n; int y[32]; int cnt=0; int main(){ cin>>n; if(n==0){ cout<<0; return 0; } while(n!=0){ int yu=n%3; y[cnt]=yu; cnt++; n=n/3; if(n==0){ break; } } for(int i=cnt-1;i>=0;i--){ cout<<y[i]; } return 0; }
Main.cc: In function 'int main()': Main.cc:13:12: error: invalid operands of types 'double' and 'int' to binary 'operator%' int yu=n%3; ^