首页 > 其他 > 详细

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

时间:2020-03-11 10:29:39      阅读:73      评论:0      收藏:0      [点我收藏+]

基本思想:

无;

 

关键点:

无;

 

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

  

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

原文:https://www.cnblogs.com/songlinxuan/p/12460038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!