题解 | #小乐乐与进制转换#
小乐乐与进制转换
http://www.nowcoder.com/practice/242eafef2a704c0ca130d563b7b3ee2d
//利用递归实现6进制的转换
#include<iostream>
using namespace std;
//函数体
void func(int n) {
int remainder = 0;
if (n == 0);
else {
remainder = n % 6;
func(n/6);
cout << remainder;
}
}
int main()
{
int n;
cin >> n;
func(n);
}