算法与数据结构课程设计之学生搭配问题
附录:源程序(带注释) 第一部分:
//利用栈的特点将十进制数转换d成进制
#include<stdio.h> #include<malloc.h> #include<conio.h>
typedef struct node /*栈节点类型*/ { int data; /*存储一个栈元素*/ struct node *next; /*后继指针*/ }snode,*slink;
int Emptystack(slink top) /*检测栈空*/ { if(top==NULL) return 1; else return 0; }
int Pop(slink *top) /*出栈*/ { int e; slink p;
if(Emptystack(*top)) return -1; /*栈空返回*/ else
{ e=(*top)->data; /*取栈顶元素*/
p=*top;