解题思路:模拟进制转换过程即可
注意事项:正序存,倒序输出
参考代码:
#include <iostream> using namespace std; int main() { int a[100]; int n; int i; while(cin>>n) { i = 0; while(n) { a[i++] = n % 8; n = n /8; } for(int j = i-1;j>=0;j--) { cout<<a[j]; } cout<<endl; } return 0; }
0.0分
0 人评分
【偶数求和】 (C语言代码)浏览:639 |
简单的for循环浏览:1408 |
【蟠桃记】 (C语言代码)浏览:1021 |
1157题解浏览:711 |
sizeof的大作用 (C语言代码)浏览:1448 |
A+B for Input-Output Practice (C语言代码)浏览:458 |
简单的a+b (C语言代码)浏览:599 |
管理学院的人数 (Java代码)浏览:531 |
Manchester- A+B for Input-Output Practice (I)浏览:1819 |
C二级辅导-进制转换 (C语言代码)正解浏览:784 |