You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
760 B
30 lines
760 B
#include <stdio.h> |
|
#include <conio.h> |
|
|
|
int notmain() |
|
{ |
|
char c='N'; //N is assigned to c |
|
|
|
for(;;) //infinite loop |
|
{ |
|
printf("%c\t",c); //N is printed over and over |
|
if(_kbhit()) //until a key is hit, the keyvalue is stored in the buffer |
|
{ |
|
c=_getch(); //c is fed the value from the buffer. The program does not pause here |
|
printf("%c",c); //print the key |
|
break; //break the loop |
|
} |
|
} |
|
_getch(); //yes, the program does pause here. |
|
return 0; |
|
} |
|
|
|
int main() |
|
{ |
|
/* Display message until key is pressed. */ |
|
while( !_kbhit() ) |
|
_cputs( "Hit me!! " ); |
|
|
|
/* Use _getch to throw key away. */ |
|
printf( "\nKey struck was '%c'\n", _getch() ); |
|
} |