How to switch bewteen differenct JAXP?
2009-08-31 16:51
369 查看
#include<stdio.h> #include<stdlib.h> struct Lnode/*以为当时做的题目没有告诉我是多少位的数字所以我选择了长度不受限的链栈*/ { int num; struct Lnode *next; }; int Push(struct Lnode *top , int x)//压入数据 { struct Lnode *p = (struct Lnode*)malloc(sizeof(struct Lnode)); p->num = x ; p->next = top->next;//其实压入无非是链表的逆序输入,此为让新的节点指针域指向上一个节点 top->next = p; return 0; } int Pop(struct Lnode *top , int *x )//*x是为了得到弹出的数据 { struct Lnode *q; q = top->next; if( top->next != NULL )//栈不为空的时候 { *x = q->num; top->next = q->next; free(q);/*如果不释放q完全可以让p->next指向下一个,要注意的是这一步不可以跟上不颠倒,q毕竟只是指针,有指向的空间才有意义*/ return 1; } else return 0; } void convey(struct Lnode *top,int a ,int b ) { int t,i,*x,c; x=&c; while( a != 0 ) { t = a % b; Push(top,t); a = a/b; } i=1; while(i) { i=Pop(top,x); if(i) printf("%d",*x); } } void main() { int a , b; struct Lnode *top; top = (struct Lnode *) malloc (sizeof(struct Lnode)); top->next = NULL; scanf("%d%d", &a , &b); convey( top , a ,b ); }
相关文章推荐
- How to switch bewteen differenct JAXP?
- play vim of how to switch to normal mode
- How to switch xcode on Mac?
- 25G Switch Vs. 40G Switch: How to Choose?
- How to switch off the automatic assignment of employee relationship
- how to find out the switch port by IP address
- How to switch trial to comercial license for HA without Internect connection on Nexenta
- How to switch a photo from jpg to png, and how to resize the photo for mac?
- 25G Switch Vs. 40G Switch: How to Choose?
- How to Install Open vSwitch on Linux
- How to reset password for cisco router and switch
- How to Programmatically Switch between the HubTile Visual States
- SDN00:How to Collect Switch Statistics (and Compute Bandwidth)
- How to implement switch statement in python
- LightSwitch how to realize two combobox linkage(如何实现2个下拉框联动)
- How to switch to the shell you want
- how to Customize Lightswitch beta 2 Login Screen to your Own design (如何定制LS的登录界面)
- How to Switch Between GDM and KDM on Ubuntu
- How to help people switch to Linux?
- How to Install Open vSwitch on Linux