Upload files to "DS/C/Lab/Week5"
This commit is contained in:
parent
44cced8454
commit
5b8ed261ff
3 changed files with 96 additions and 56 deletions
|
@ -30,7 +30,7 @@ int isOperator(char c) {
|
|||
|
||||
void postfixToInfix(const char* postfix) {
|
||||
char op1[MAX_EXPR_LEN], op2[MAX_EXPR_LEN], temp[MAX_EXPR_LEN];
|
||||
|
||||
|
||||
for (int i = 0; postfix[i] != '\0'; i++) {
|
||||
if (!isOperator(postfix[i])) {
|
||||
temp[0] = postfix[i];
|
||||
|
@ -43,7 +43,7 @@ void postfixToInfix(const char* postfix) {
|
|||
push(temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("Infix expression: %s\n", stack[top]);
|
||||
}
|
||||
|
||||
|
@ -53,4 +53,4 @@ int main() {
|
|||
gets(postfix);
|
||||
postfixToInfix(postfix);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue