/************************************************/ /* */ /* COSC 1337, CS2, Unix/C++, */ /* Lamar University, Chung-Chih Li */ /* Oct-19-2004 */ /************************************************/ #include #include #include #include using namespace std; struct token { int value; // The value of operand or ascii of an operator int priority; // 0 means operand }; int main() { string expression; deque token_string(0); vector op_stack(0); vector value_stack(0); token k; int i, value=0; cout << "\nInput an Arithmetic Expression:\n\n"; cin >> expression; k.value = 0; k.priority = -1; // In case the 1st token is not a number, // make it to nonzero, so no extra token will // be pushed at lines 45-46; for (i=0; i