| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 75427 | 张誉腾 | 十进制转R进制 | C++ | Compile Error | 0 MS | 0 KB | 1437 | 2024-05-26 17:43:19 |
#include<bits/stdc++.h> using namespace std; int main() { double n; cin>>n; int r; cin>>r; int z=n; double x=n-z; int b[32],cnt=0; while(z!=0) { int yu=z%r; b[cnt]=yu; cnt++; z/=r; } if(cnt==0) { cout<<0; } for(int i=cnt-1; i>=0; i--) { if(b[i]<10) { cout<<b[i]; } if(b[i]=10) { cout<<"A"; } if(b[i]=11) { cout<<"B"; } if(b[i]=12) { cout<<"C"; } if(b[i]=13) { cout<<"D"; } if(b[i]=14) { cout<<"E"; } if(b[i]=15) { cout<<"F"; } if(b[i]=16) { cout<<"G"; } if(b[i]=17) { cout<<"H"; } if(b[i]=18) { cout<<"I"; } if(b[i]=19) { cout<<"J"; } if(b[i]=20) { cout<<"K"; } if(b[i]=21) { cout<<"L"; } if(b[i]=22) { cout<<"M"; } if(b[i]=23) { cout<<"N"; } if(b[i]=24) { cout<<"O"; } if(b[i]=25) { cout<<"P"; } if(b[i]=26) { cout<<"Q"; } if(b[i]=27) { cout<<"R"; } if(b[i]=28) { cout<<"S"; } if(b[i]=29) { cout<<"T"; } if(b[i]=30) { cout<<"U"; } if(b[i]=31) { cout<<"V"; } if(b[i]=32) { cout<<"W"; } if(b[i]=33) { cout<<"X"; } if(b[i]=34) { cout<<"Y"; } if(b[i]=35) { cout<<"Z"; } } } if(x!=0) { cout<<"."; } else { return 0; } for(int i=0; i<9; i++) { x=x*r; int xz=x; cout<<xz; x=x-xz; if(x==0) { break; } }
Main.cc: In function 'int main()':
Main.cc:26:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=10) {
^
Main.cc:29:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=11) {
^
Main.cc:32:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=12) {
^
Main.cc:35:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=13) {
^
Main.cc:38:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=14) {
^
Main.cc:41:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=15) {
^
Main.cc:44:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=16) {
^
Main.cc:47:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=17) {
^
Main.cc:50:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=18) {
^
Main.cc:53:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=19) {
^
Main.cc:56:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=20) {
^
Main.cc:59:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=21) {
^
Main.cc:62:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=22) {
^
Main.cc:65:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=23) {
^
Main.cc:68:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=24) {
^
Main.cc:71:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=25) {
^
Main.cc:74:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=26) {
^
Main.cc:77:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=27) {
^
Main.cc:80:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=28) {
^
Main.cc:83:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=29) {
^
Main.cc:86:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=30) {
^
Main.cc:89:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=31) {
^
Main.cc:92:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=32) {
^
Main.cc:95:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=33) {
^
Main.cc:98:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=34) {
^
Main.cc:101:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b[i]=35) {
^
Main.cc:11:9: warning: unused variable 'x' [-Wunused-variable]
double x=n-z;
^
Main.cc: At global scope:
Main.cc:106:1: error: expected unqualified-id before 'if'
if(x!=0) {
^
Main.cc:108:3: error: expected unqualified-id before 'else'
} else {
^
Main.cc:111:1: error: expected unqualified-id before 'for'
for(int i=0; i<9; i++) {
^
Main.cc:111:14: error: 'i' does not name a type
for(int i=0; i<9; i++) {
^
Main.cc:111:19: error: 'i' does not name a type
for(int i=0; i<9; i++) {
^