第五周项目三 括号的匹配
来源:互联网 发布:快速选择中值算法 编辑:程序博客网 时间:2024/06/06 04:43
/*文件名称:括号的匹配作 者:胡德杰完成日期:2017年10月12号版 本 号:v1.1.13*/#include <stdio.h>#include "sqstack.h"int main(){char c; char st[50]; int d=1, i; SqStack *s; InitStack(s); printf("请输入表达式:"); scanf("%s", st); for(i=0; st[i]!='\0'&&d; i++) { switch(st[i]) { case'(': case'[': case'{': Push(s, st[i]); break; case')': Pop(s,c); if(c!='(') d=0; break; case']': Pop(s,c); if(c!='[') d=0; break; case'}': Pop(s,c); if(c!='{') d=0; break; } } if(StackEmpty(s)&&d==1) printf("配对正确!!\n"); else printf("配对错误!!\n"); return 0;}
知识点总结:对进栈和出栈的应用
学习心的:建立栈算法库的时候感觉栈没有用而且很无聊,担当真正用起来的号死后才发现他的乐趣。
阅读全文
0 0
- 第五周项目三 括号的匹配
- 第五周【项目三-括号的匹配】
- 第五周- 项目三 括号的匹配
- 第五周--项目三--括号的匹配
- 第五周项目三-括号的匹配
- 第五周 项目三 括号的匹配
- 第五周 项目三----括号的匹配
- 第五周项目三 括号的匹配
- 第五周项目三 括号的匹配
- 第五周项目三 括号的匹配
- 第五周项目三(括号的匹配)
- 第五周项目三-括号的匹配(栈)
- 第五周——项目三—括号的匹配
- 第五周项目三—括号的匹配
- 第五周项目三——括号的匹配
- 第五周项目三—括号的匹配
- 第五周线性表 项目(三)括号的匹配
- 数据结构 第五周项目三 括号的匹配
- 《Spring技术内幕》学习笔记3——IoC容器载入Bean定义资源文件
- 第7周项目2 建立链队算法库
- HashMap和Hashtable的区别
- Android Activity生命周期以及Fragment生命周期的区别与分析
- Android测试环境搭建(win7)
- 第五周项目三 括号的匹配
- linux命令加杠不加杠,单杠与双杠
- MySQL数据类型选择
- android官方侧滑菜单DrawerLayout详解
- 航院5538:House Building
- esp8266烧写MicorPython
- android 使用httpURLConnection post方式访问接口的简单工具包
- Linux目录与文件的权限意义
- Android 实现沉浸式(使用SystemBarTint第三方)