Path: utzoo!attcan!uunet!husc6!yale!cs.utexas.edu!ut-emx!emx.utexas.edu From: ezab066@emx.utexas.edu (Albert Wu) Newsgroups: comp.sys.mac.apps Subject: THINK C: Prog Work w/ANSI But Not ANSI881 Message-ID: <37733@ut-emx.uucp> Date: 27 Sep 90 23:55:32 GMT Sender: ezab066@ut-emx.uucp Organization: The University of Texas at Austin; Austin, Texas Lines: 32 I used an SE/30 and tried running the following program with THINK C 4.02. It worked fine if I linked ANSI but the numbers were not even read correctly if I linked ANSI881. The program comes from page 2 of Narain Gehani's C: An Advanced Introduction. /* Two dollar calculator */ #include #include #define PR putchar(':') main(void) { float a, b; char opr; float result; while (PR, scanf("%f%c%f", &a, &opr, &b) != EOF ){ printf ("a=%g; opr=%c; b=%g\n\n", a, opr, b); switch (opr) { case '+': result = a + b; break; case '-': result = a - b; break; case '*': result = a * b; break; case '/': result = a / b; break; default: printf ("Error: bad operator\n"); exit (EXIT_FAILURE); } printf ("*** %g%c%g = %g\n", a, opr, b, result); } exit (EXIT_SUCCESS); }