举一个简单的例子,如果有按键,就输出相关按键。否则,输出“.”。每隔 100 毫秒输出一次。按 ESC 退出。
注:ESC 的 ASCII 码是 27。

#include <stdio.h>
#include <malloc.h>
#include<graphics.h>
#include<conio.h>
#define LEN sizeof(struct student)
#include "math.h"
#define PI 3.1415926

main()

{

char c=0;
while(c!=27)
{

if(kbhit())
c=getch();
else
c='.';
printf("%c",c);
Sleep(100);

}

}

相关文章:

  • 2021-11-02
  • 2021-06-22
  • 2021-08-26
  • 2021-07-24
  • 2022-12-23
  • 2021-05-19
  • 2021-05-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案