#include<stdio.h>
#include<time.h>
#include<conio.h>
int main()
{
clock_t start_t,end_t;
start_t=clock();
int hour,minute,second;
while(1)
{
if(getch()==' ')
{
end_t=clock();
second=(end_t-start_t)/CLOCKS_PER_SEC;
minute=((end_t-start_t)/CLOCKS_PER_SEC)/60;
hour=((end_t-start_t)/CLOCKS_PER_SEC)/3600;
printf("%d:%d:%d\n",hour,minute,second);
start_t=clock();}
else if (getch()=='\r')break;
}
return 0;
}
计时——运用循环语句
最新推荐文章于 2022-11-24 23:28:25 发布