摘要: 题目:求字符串表达式(不含括号)的值思路:数字分离运算符优先级+-*/只需一个字符串栈,保存数字和运算符代码:#include#include#include#includeusing namespace std;templateout_T convert(const in_T &t){ st... 阅读全文
posted @ 2015-10-24 23:20 AndyJee 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 题目:求字符串表达式的值,如"-2+(3+4)-5*6",返回-25.思路:分离数字和运算符并考虑运算符的优先级,如(),*,/,+,-等。两个栈:一个存数字,一个存运算符代码:#include#include#include#includeusing namespace std;double ca... 阅读全文
posted @ 2015-10-24 21:22 AndyJee 阅读(654) 评论(0) 推荐(0) 编辑