#include <iostream>
#include <cstdlib>
using namespace std;
#define maxsize 30
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int x,y; //十进制数x转任意y进制数,
cin>>x>>y;
int i=-1;
int a[maxsize+1];
do{
a[++i]=x%y;
x/=y;
}while(x!=0);
for(int j=i;j>=0;j--)
cout<<a[j];
return 0;
}
数制转化代码
最新推荐文章于 2024-08-15 05:02:54 发布