用递归函数实现十进制转八进制
#include <iostream>
using namespace std;
int func(int n);
int main()
{
int n;
cout<<"请输入十进制正整数"<<endl;
cin>>n;
cout<<func(n)<<endl;
return 0;
}
int func(int num)
{
if(num<=8)
return num;
return num%8+10*func(num/8);
}