#include "C:\Practice Programs\Puzzle Feuer\Puzzles\defs.h" #define ENUF 3 #define EOS '\0' //End Of String #define NEXT(i) input[i++] #define FALSE 0 #define TRUE 1 char input[] = "PI=3.14159, approximately"; // Use as a marker to see what is going on. //#define DID(x,c) printf("\n Did we get here? %d c = %0x \n",x,c) /* In 'while( c=NEXT(i) != EOS )' '!=' (not equal to)has higher order of persidance than '=' assignment oporator. So in 'while( c=NEXT(i) != EOS )' 'c' only get the true or false evaluation of 'NEXT(i) != EOS' In 'while( (c=NEXT(i))!=EOS && !done )' remember Please Excuse My Dear Ant Saly. The parentheses have highest order of precedence in math and C. In C '() [] -> .' have highest precedence. So in 'while( (c=NEXT(i))!=EOS && !done )', 'c=NEXT(i)' gets done first. */ void main() { char c; int done, high, i, in, low; i=low=in=high=0; while( c=NEXT(i) != EOS ) if( c<'0' ) low++; // '0' == hex 30, dec 48 else if( c>'9' ) high++; // '9' == hex 39, dec 57 else in++; PRINT3(d,low,in,high); i=low=in=high=0; done=FALSE; while( (c=NEXT(i))!=EOS && !done ) if( c<'0' ) low++; else if( c>'9' ) high++; else in++; if( low>=ENUF || high>=ENUF || in>=ENUF ) done=TRUE; PRINT3(d,low,in,high); i=low=in=high=0; done=FALSE; while( (c=NEXT(i))!=EOS && !done ) if( c<'0' ) done = (++low==ENUF ? TRUE : FALSE) ; else if(c>'9' ) done = (++high==ENUF ? TRUE : FALSE); else done = (++in==ENUF ? TRUE : FALSE); PRINT3(d,low,in,high); }