//--------------------------------expressions.h------------------------------ #include <stdio.h> #include <ctype.h> #include <stdlib.h> class Arithparser { public: enum { WORD_MAX = 100 }; double parse (char *string, double lookup (char *)); private: struct { char type; /* ( = left parenthesis, ) = right parenthesis, z = end of token stream, o = operator, n = numerical value, i = identifier */ double value; /* if type==o, then 1=+, 2=-, 3=*, 4=/ */ } tokens[WORD_MAX]; int tokenpointer; void tokenize (char *string, double lookup(char *)); double perform (double operand1, double opcode, double operand2); double parseval (int *tptr); double nextoperand (int *tptr); };