Programming

Good programming style

 
#include <dos.h>
#include <stdlib.h>
#define q(x)for(x;)
char far*v=MK_FP(5\
<<13,0);b(x,y,w,h,c
)int x,y,w,h,c;{int
i;q(;h--)q(i=0;i<w)
v[x+i+++(y+h)*320]=
c;;}main(){int i=9;
;__emit__( 0x13B8,\
0xCD00,16);q(;i)b(\
0, 25*i---25,rand()
%320,25,i);getch();
;__emit__( 0x03B8,\
0xCD00,16);}

A well written program is easy to read... For example, let's take a look at the code on the left. You can immediately see that the it will draw a graph that has eight horizontal bars with different color and random length, right?

What??? You can't?
That's supposed to be a beginner level program in C!

Oh, all right... It's a little prank I made with Maglob for a youngster who needed help with his homework. Unfortunately he didn't express any desire to understand the code so we made it a little obfuscated. Hehehe! :)

The code has been made with Turbo C++ 1.0 and because of the __emit__ commands I doubt that it will compile with anything else.

Return to main page