c语言倒计时时钟程序
如果你有TC,可以试试。
VC的Kbhit()无法返回键名。
23时59分59秒-86400秒
# include & ltstdio.h & gt
# include & ltwindows.h & gt
# include & ltconio.h & gt
void main()
{
long int t;
int flag = 0;
t = 86400
printf("按S开始,按E停止\ n ");
while(1)
{
if(kb hit()= = ' S ' | | kb hit()= = ' S ')flag = 1;
if(kb hit()= = ' E ' | | kb hit()= = ' E ')flag = 0;
睡眠(1000);
if(flag = = 1)t = t-1;
if(t & lt;= 0)断开;
printf("%d ",t);
}