-Bracket Matching
Match Int (char * cs, int size);
1. Make an empty stack. Read the characters until the end of the file.
2. To judge the characters that are read,
2.1 If the character is a left parenthesis, then into the stack;
2.2 If the character is a closing parenthesis, if the stack empty or pop-up left parenthesis does not match, then the match fails;
2.3 Input end, if the stack is not empty, the match fails, otherwise the match succeeds.
-evaluates the value of the suffix expression (assuming the suffix expression is correct)
int Postfixvalue (char * expression, int size);
1. Make an empty stack, read the characters until the end of the file.
2. To judge the characters that are read,
2.1 If the number, then into the stack;
2.2 If it is an operator, it pops up two digits and the results are counted into the stack.
3. After the completion of the calculation, the final pop-up value is the final calculation results.
-infix expression suffix expression (assuming infix expression is correct)
void Convertexpression (char * expression, int size);
1. Make an empty stack, read the characters until the end of the file.
2. To judge the characters that are read,
2.1 If it is the operand, direct output;
2.2 If the operator (+-*/)
2.2.1 If the stack is not empty and the top of the stack has precedence over the current operator precedence, all the precedence in the output stack is greater than the current element's operator;
2.2.2 The current element into the stack;
2.2.3 The above four operators have precedence greater than ' (' precedence '.
2.3 If the operator ' (', then the stack.
2.4 If the operator ' is ', then the stack all ' (' before the stack element, ' (' Out of stack, ' but not added to the final expression.