华中科技大学机试 八进制 Easy

萝らか妹 提交于 2020-03-11 01:51:59

基本思想:

无;

 

关键点:

无;

 

#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);
	}
}

  

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!