C语言堆栈算法数.ppt

上传人:bao****ty 文档编号:144816737 上传时间:2020-09-14 格式:PPT 页数:6 大小:142.50KB
返回 下载 相关 举报
C语言堆栈算法数.ppt_第1页
第1页 / 共6页
C语言堆栈算法数.ppt_第2页
第2页 / 共6页
C语言堆栈算法数.ppt_第3页
第3页 / 共6页
C语言堆栈算法数.ppt_第4页
第4页 / 共6页
C语言堆栈算法数.ppt_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《C语言堆栈算法数.ppt》由会员分享,可在线阅读,更多相关《C语言堆栈算法数.ppt(6页珍藏版)》请在金锄头文库上搜索。

1、C语言堆栈算法数制转换,22栋附102寝室 谌敦斌、郭燚、耿凯、董楗、 梁攀攀、鄢应钊,2,Stack.c,#include #include int conversion(int n,int r); typedef struct _stack int size; int* base; int* sp; stack; void init(stack* s, int n) s-base = (int*)malloc(sizeof(int)*n); s-size = n; s-sp = s-base; ,3,Stack.c,int push(stack* s, int val) if(s-sp -

2、 s-base = s-size) puts(overflow); exit(1); return *s-sp+ = val; int pop(stack* s) if(s-sp = s-base) puts(underflow); exit(2); return *-s-sp; ,4,Stack.c,int empty(stack* s) return s-sp = s-base; void clean(stack* s) if(s-base) free(s-base); int main() int n,r; scanf(%d%d, ,5,Stack.c,int conversion (int n,int r) stack s; init( ,6,运行,15 2 1 1 1 1 Press any key to continue 98 8 1 4 2 Press any key to continue 100 16 6 4 Press any key to continue,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号