八进制 题解:
#include<bits/stdc++.h>
using namespace std;
void f(int x){
char y[66] = {0};
int i = 0;
while(x){
y[i++] = x % 8 + '0';
x = x / 8;
}
for (int j = i - 1; j >= 0; j--) {
printf("%c", y[j]);
}
printf("\n");
}
int main(){
int x;
while(scanf("%d", &x) != EOF){
f(x);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发