有谁可以用c语言编一个 0到59秒循环的秒表的程序

如题所述

#include <windows.h>
#include <stdio.h>
#include<stdlib.h>

int main()
{
A_group:int i = 0;

while (1)
{
system("CLS");
printf("%02d\n", i++);
Sleep(1000);
if (i==60)
{
goto A_group;
}
}
system("pause");
}
纯手打 希望采纳,程序已测试可直接用!追答

采纳

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-12-28
#include <windows.h>
#include <stdio.h>

int main()
{
int i=0;
while(1)
{
system("CLS");
printf("%02d\n",i++);
printf("Press any key to exit\n");
if(_kbhit()) return 0;
i%=60;

Sleep(1000);
}
}本回答被网友采纳
第2个回答  2015-12-28
#include <windows.h>
#include <stdio.h>

int main()
{
int i=0;
while(i<10)
{
system("CLS");
printf("%02d\n",i++);
i%=60;
Sleep(1000);
}
return 0;
}追答

要几秒有几秒,但只能在Windows系统下运行。

相似回答