**
#include< stdio.h>
#include< stdlib.h>
#include < string.h>
#define N 100
typedef struct nima{
char a;
}data;
typedef struct hehe{
data *c;
int u;
int max;
}arry;
void frist(arry*fist)
{
fist->c= (data*)malloc(sizeof(data)*N);
fist->max = N;
fist->u = 0;
}
void push(arry*fist,char m)
{
fist->c[fist->u].a = m;
if(fist->u == fist->max){
printf("full");
exit(0);
}
printf("%c ",fist->c[fist->u].a);
fist->u++;
}
void pop(arry*fist,char *m)
{
if((fist->u-1)<0){
printf("error");
exit(0);
}
fist->u--;
*m=fist->c[fist->u].a;
}
void suan(arry*fist,char a[],int m,int d)
{
int j = strlen(a);
int sum = 0;
int dd;
for(int i =0;i<j;i++)
{
dd=1;
for(int i_1 = j-i-1;i_1>0;i_1--)
{
dd=dd*m;
}
if(a[i]>='0'&&a[i]<='9')
sum= sum+dd*(a[i]-'0');
if(a[i]>='a'&&a[i]<='f')
sum = sum+dd*(a[i]-'a'+10);
if(a[i]>='A'&&a[i]<='F')
sum= sum+dd*(a[i]-'A'+10);
}
printf("%d\n",sum);
int mm;
char cc;
while(sum)
{
mm = sum%d;
if(mm>=10)
{
cc = 'a'+mm-10;
}
else
{
cc = '0'+mm-0;
}
push(fist,cc);
sum = sum/d;
}
printf("%d\n",fist->u);
int jjj = fist->u;
for(int i=0;i<jjj;i++)
{
pop(fist,&cc);
printf("%c",cc);
}
printf("\n");
}
int main()
{
arry fist;
frist(&fist);
char aa[N];
int i;
int d;
scanf("%s",aa);
printf("进制\n") ;
scanf("%d",&i);
printf("换\n");
scanf("%d",&d);
suan(&fist,aa,i,d);
return 0;
}
**
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。