//--------------------------------expressions.h------------------------------ #include <stdio.h> #include <ctype.h> #include <stdlib.h> class arithparser { public: 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[100]; 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); };
Hosted by www.Geocities.ws

1