Run ID:3845
提交时间:2024-07-13 18:18:25
# include<iostream> using namespace std; int main(){ double a,y; int x; string b; cin>>a; x=a; y=a-x; while(x){ char c=x%2+'0'; b=c+b; x/=2; } if(y!=0){ b=b+"."; while(y!=0){ y*=2; if(y>=1){ b=b+"1"; y-=1; } } } if(b=="")cout<<"0"; else cout<<b; return 0; }