#include<time.h>
#include<stdio.h>
#include<conio.h>
#include<windows.h>
int main()
{
int hour,minute,second;
clock_t startTime,endTime;
printf("start\n");
a:startTime=clock();
if(getch( )==' ')
{
endTime=clock();
hour=((endTime-startTime)/CLOCKS_PER_SEC)/3600;
minute=((endTime-startTime)/CLOCKS_PER_SEC)%3600/60;
second=((endTime-startTime)/CLOCKS_PER_SEC)%60;
printf("%d:%d:%d\n",hour,minute,second);
goto a;
}
if(getch()=='\n')goto b;
b:return 0;
}
计时——运用goto
最新推荐文章于 2019-10-14 21:37:46 发布