void conversion (SqStack *pstack,unsigned int N, const unsigned int d){ if( pstack == NULL)//当传入参数为指针,必须判空 exit(-1); int mod ;//保存mod = N %d while( N != 0){ mod = N %d; stack_push(pstack,&mod);//将mod入栈 N = N /d; } int top = 0;//显示栈顶元素 printf("将10进制的%d转为%d进制后为:",N,d); while(!stack_is_empty(pstack)){ stack_pop(pstack,&top); printf("%d",top); } return ; }
2.结果与结论
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/tianxiaolu1175/article/details/47842763