华中科技大学机试 八进制 Easy
基本思想:
无;
关键点:
无;
#include<iostream>
#include<string>
using namespace std;
void charge(int n) {
string res = "";
if (n == 0) {
cout << 0 << endl;
return;
}
while (n != 0) {
res = char('0' + n % 8) + res;
n /= 8;
}
cout << res << endl;
}
int main() {
int n;
while (cin >> n) {
charge(n);
}
}

浙公网安备 33010602011771号