SDUT 2131 数据结构实验之栈一:进制转换

 1 #include<stdio.h>
2 int main()
3 {
4 int n,m,i,r,top = 0;
5 char stack[100];
6 scanf("%d%d", &n,&m);
7 while(n)
8 {
9 top++;
10 stack[top] = n%m;
11 n = n/m;
12 }
13 while(top!=0)
14 {
15 printf("%d", stack[top]);
16 top--;
17 }
18 printf("\n");
19 return 0 ;
20 }
原文地址:https://www.cnblogs.com/shangyu/p/2346944.html