{ time_t start,end; int i;
start=time(NULL); for(i=0;i<3000;i++)
{ printf(\ end=time(NULL);
printf(\ }
============================================================== 【程序93】
题目:时间函数举例3 1.程序分析: 2.程序源代码: /*calculate time*/ #include \ #include \ main()
{ clock_t start,end; int i; double var; start=clock(); for(i=0;i<10000;i++)
{ printf(\ end=clock();
printf(\ }
============================================================== 【程序94】
题目:时间函数举例4,一个猜数游戏,判断一个人反应快慢。(版主初学时编的) 1.程序分析: 2.程序源代码: #include \ #include \ #include \ main() {char c; clock_t start,end; time_t a,b; double var; int i,guess; srand(time(NULL));
printf(\y' or 'n') \\n\ loop:
while((c=getchar())=='y')
{ i=rand() 0;
printf(\ start=clock(); a=time(NULL); scanf(\ while(guess!=i) {if(guess>i)
{printf(\ scanf(\ else
{printf(\ scanf(\ }
end=clock(); b=time(NULL);
printf(\ printf(\ if(var<15)
printf(\ou are very clever! \\1\\1\\n\\n\ else if(var<25)
printf(\ else
printf(\ printf(\ printf(\ }
printf(\ if((c=getch())=='y') goto loop; }