home *** CD-ROM | disk | FTP | other *** search
- // callcw.c - An example of a C program that uses the parser
-
- #include <string.h>
- #include "parslib.h"
- #include <stdio.h>
- #include <math.h>
-
- char s[100] = "";
- double result;
- short valid;
-
- int main()
- {
- printf("CALC CW - HyperAct Inc.\n");
- // printf("%ld, %ld", &s, &valid);
- while (strcmp(s, "EXIT") != 0) {
- printf("CALC> ");
- gets(s);
- strupr(s);
- if (strcmp(s, "EXIT") != 0) {
- result = GETEXPR(s, valid);
- if (valid)
- printf("\n = %E\n", result);
- else
- printf("\n error at position %d\n", floor(result));
- } // if ..
- } // while ..
- return 0;
- }
-
-
-
-