70,020
社区成员




#include <windows.h>
#include <conio.h>
int main()
{
printf("如果你三秒钟之内什么也不输入,我就输出-1。\n");
Sleep(3000);
if(!_kbhit())
printf("-1\n");
else
printf("输入了%c", getchar());
return 0;
}
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <locale.h>
int main() {
int k;
setlocale(LC_ALL,"chs");
printf("如果你三秒钟之内什么也不输入,我就输出-1。\n");
Sleep(3000);
if(!_kbhit())
printf("-1\n");
else {
printf("输入了");
while (1) {
if (_kbhit()) {
k=_getch();
if (k==0 || k==0xe0) k=(k<<8)|_getch();
if (0x21<=k && k<=0x7E) printf("%c",k);
else printf("<%04x>",(unsigned)k);
} else break;
}
printf("\n");
}
return 0;
}