以下代码:
#include<iostream>
using namespace std;
char d[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int t(int a,int b)
{int r=a%b;a=a/b;
if(a!=0) t(a,b);
cout<<d[r];
}
int main()
{
int a,b;
cin>>a>>b;
t(a,b);
cout<<endl;
}
用char定义"11"……;灵活运用函数,数组。