C C++表达式求值的实验报告,附有详细的注释。
2022-05-05 17:29:22 77KB C C++ 表达式求值
1
数据结构表达式求值.docx
2022-04-06 00:37:41 34KB 计算机
对于基本的算术表达式,以字符序列的形式从终端进行输入,要求语法正确的,不含变量,按照算术运算优先级顺序,实现基本算术表达式的运算过程。 (1) 输入:输入一个算术表达式,以#结束 (2) 输出:输出数据栈栈顶元素和最后表达式的运算结果 (3) 程序功能:完成包含加、减、乘、除运算,包含括号的基本整数表达式的运算,可实现动态的输入,实时的输出。 (4) 测试数据:3*(7-2)和自选数据
1
对用+、-、*、/、(、)连接起来的算术表达式求值, 可以智能识别和过滤表达式。
2022-03-27 15:37:27 2KB 表达式求值四则运算
1
中续表达式变换后续表达式,可进行+ - * / % ()运算,可扩展值Sin,cos,tan,sqrt,需要源码联系cug_peng@163.com
2022-03-21 15:35:09 2.04MB 计算器
1
mfc完整的实现了算数表达式求值,设计完美
2022-03-21 15:24:00 1.53MB mfc 表达式求值 数据结构
1
该资源对应的描述文章: http://blog.csdn.net/stevenkylelee/article/details/43099789
2022-03-18 11:18:50 32KB 表达式求值
1
#include"stdio.h" char A[7]={'+','-','*','/','(',')','#'}; char B[7][7]={{'>','>','<','<','','>'}, {'>','>','<','<','','>'}, {'>','>','>','>','','>'}, {'>','>','>','>','','>'}, {'<','<','<','<','','>','>','>','0','>','>'}, {'<','<','<','<','top=S->base=0; } void Initstack2(stack2 *S) { S->top=S->base=0; } int push1(stack1 *S,char ch) { S->s[S->top]=ch; S->top++; } int push2(stack2 *S,int ch) { S->s[S->top]=ch; S->top++; } int search(char ch) { int i=0; while(ch!=A[i]) { i++; } return i; } char precede(char c1,char c2) { int i,j; i=search(c1); j=search(c2); return B[i][j]; } char gettop1(stack1 S) { char e; if(S.top==S.base) printf("!!!"); e=S.s[S.top-1]; return e; } int gettop2(stack2 S) { int e; if(S.top==S.base) printf("!!!"); e=S.s[S.top-1]; return e; } char pop1(stack1 *S) { if(S->top==S->base) return('!'); else { S->top--; return(S->s[S->top]); } } int pop2(stack2 *S) { if(S->top==S->base) return('!'); else { S->top--; return(S->s[S->top]); } } int operate(int a,char op,int b) { switch(op) { case '+':return(a+b);break; case '-':return(a-b);break; case '*':return(a*b);break; case '/':return(a/b);break; } } int main() { struct stack1 OPTR; struct stack2 OPND; char c,op; int a,b,an; Initstack1(&OPTR); push1(&OPTR,'#'); Initstack2(&OPND); c=getchar(); while(c!='#'||gettop1(OPTR)!='#') { if(c>='0'&&c='0'&&c='0'&&c<='9'); } else { switch(precede(gettop1(OPTR),c)) { case '': op=pop1(&OPTR);a=pop2(&OPND);b=pop2(&OPND); push2(&OPND,operate(b,op,a));break; }//switch } //else } //while an=pop2(&OPND); printf("\nyour answer is:\n=%d",an); }
2022-03-07 21:01:18 3KB 堆栈表达式求值
1
课程作业的表达式求值,手写链栈实现,详细解释一看就懂!
2022-03-03 19:34:28 4KB 链栈表达
1
更改了一下中缀表达式转后缀表达式以及后缀表达式求值的算法,加入了对小数、负数的支持,注释完整,也可随时联系我。
2022-01-08 21:04:21 9KB c算法 数据结构
1