女人被躁到高潮嗷嗷叫游戏,久久久久亚洲av成人人电影,久久久精品人妻一区二区三区四,久久久久无码精品国产app,免费人成视频在线播放

留求藝—您的留學(xué)規(guī)劃師

用c語言的棧來編寫逆波蘭公式的程序

313次

問題描述:

用c語言的棧來編寫逆波蘭公式的程序希望能解答下

最佳答案

推薦答案

如題,代碼如下,歡迎探討?。?![code=C/C++][/code]#include typedef int ElemType; #define MAXNUM 16struct stack{ElemType data[MAXNUM];int top;};void StackInit(struct stack *stack){int i = 0;for(;i< MAXNUM;i++){stack->data[i] = 0;}stack->top = 0; }void StackPush(struct stack *stack,ElemType c){if(MAXNUM == stack->top) {printf("The stack is full ");return;}stack->data[stack->top++] = c;}ElemType StackPop(struct stack *stack){if(0 == stack->top){printf("The stack is empty "); }int ChangeToPostfix(char *str){int i = 0,flag = 0; int c,ch;struct stack ch_stack;struct stack op_stack;StackInit(&ch_stack);StackInit(&op_stack);while( != (c = *(str + i))) {if((* == c) || (/ == c) || (( == c)){flag = 0;StackPush(&op_stack,c);}else if() == c){flag = 0;while(( != (c = StackPop(&op_stack))){StackPush(&ch_stack,c);}if(0 == op_stack.top){printf("the ( hasnt found when the ) come in! ");return -1;}}else if((+ == c)|| (- == c)){flag = 0;if(0 != op_stack.top) { while(( != (ch = StackPop(&op_stack))){StackPush(&ch_stack,ch);if(0 == op_stack.top){break;}}}StackPush(&op_stack,c);}else if((c >= 0) && (c

用c語言的棧來編寫逆波蘭公式的程序

為你推薦

網(wǎng)站首頁(yè)  |  關(guān)于我們  |  聯(lián)系方式  |  用戶協(xié)議  |  隱私政策  |  在線報(bào)名  |  網(wǎng)站地圖