Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
108200 胡盛哲 十进制小数转二进制 C++ Compile Error 0 MS 0 KB 423 2025-01-19 15:10:40

Tests(0/0):


Code:

#include <iostream> using namespace std; double x; double y = x - t; int a[33] ; int t = x; int i = 0; int main() { cin>>x; if(t==0){ cout<<0; } while(t != 0) { a[i] = t % 2; t = t/2; i++; } for(int j = i - 1; j >= 0; j--) { cout<<a[j]; } if(y != 0) { cout<<'.'; while(y != 0) { y = y * 2; cout<<(int)y; y = y - ((int)y); } } cout<<endl; return 0; }


Run Info:

Main.cc:4:16: error: 't' was not declared in this scope
 double y = x - t;
                ^