char c;
clock_t start,end;
time_t a,b;
double var;
int i,guess;
srand(time(NULL));
loop:
printf("DO YOU WANT TO PLAY IT .('y' or 'n')\n");

while((c=getchar())=='y')
{

i=rand()%100;

printf("\n please input number you guess:\n");
start=clock();
a=time(NULL);
scanf("%d",&guess);
while(guess!=i)
{
if(guess!=i)
{
if(guess>i)
{
printf("please input a little smaler.\n");
scanf("%d",&guess);
}
else
{
printf("please input a little bigger\n");
scanf("%d", &guess);
}

}
end=clock();
b=time(NULL);
printf("\1:it took you %6.3f seconds\n",var=(double)(end-start)/18.2);
printf("\1:it took %6.3f seconds\n\n",difftime(b,a));
if(var<15)
printf("\1\1 you are very clever! \1\1\n\n");
else if(var<25)
printf("\1\1 you are norma!\1\1\n\n");
else
printf("\1\1 you are stupid ! \1\1\n\n");
printf("\1\1 congreatulations \1\1\n\n ");
printf("the number you guess is %d",i);

}
printf("\n do you want to try it agin ?('y' or 'n')\n");
c=getch();

if(c=='y')
printf("\n do you want to try it agin ?('y' or 'n')\n");

//goto loop;

}

//return 0;

/*//你也可以用clock函数来计算你的机器运行一个循环或者处理其它事件到底花了多少时间:

long i = 10000000L;
clock_t start, finish;
double duration;
//测量一个事件持续的时间
printf( "Time to do %ld empty loops is ", i) ;
start = clock();
while( i-- );
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%f seconds\n", duration );
system("pause");

*/

}

05-11 17:03