User:Pc free mind reader/sandbox

/*

This C code will allow any new (beginner) C programmer to make a program which will detect ik the arrow keys, .etc keys are pressed.

Code supported by Borland Torbo C/C++ 3.0 IDE.

* /


 * 1) include 


 * 1) include 

void main

{

char a=NULL;

_setcursortype(_NOCURSOR);

textcolor(WHITE);

textbackground(0);

begin:

clrscr;

printf("KEY PRESSED =\n\t%c\n\nKEY NUMBER =\n\t%d",a,a);

a=getch;

if (a == 27)

{

goto exit;

}

goto begin;

exit:

clrscr;

printf("KEY PRESSED =\n\t%c\n\nKEY NUMBER =\n\t%d",a,a);

getch;

a=NULL;

textcolor(7);

_setcursortype(_NORMALCURSOR);

clrscr;

fflush(stdin);

fflush(stdout);

}

/*

Press escape key to exit the program.

open the program and when it displayes a word KEY then press the esc key, then note the key number. See "if (a == 27)" 27 means ESC key.

NOTE: Will not work in javascript, .etc, you may create or find better way to detect arrow keys in C.

* /