Thursday, March 29, 2007

Reality Checker

I wrote an interesting piece of C code the other day:


#include <stdio.h>

int main()
{
float x;

/*Tell the user what the program does*/

printf("This program checks for the presence of reality.\n");

/*Check for reality using math, and display the result*/

if(x<x+1)
{
printf("Yep, it's there.\n");
}
else
{
printf("Nope, it's gone. Of course, as it's gone, I might be inaccurate about
that,\
in which case it would be present, and I would be right.\n");

}

return (0);
}


It checks for the presence of reality by seeing if x is lesser than x+1. If it is, than all is well and reality is intact. If it is not, than the program informs you that reality has vanished, but, as it's not intact, the program may be incorrect in its assessment.

Of course, it's also good for making sure that your computer isn't dead.

No comments: