#include "chat.h"
int main (void)
{
char ch;
long i = 10000000;
clock_t st,ed;
double duration;
st=clock();
while (1)
{
ch = getchar();
if(ch=='y')
break;
}
ed = clock();
duration = (double)(ed - st) / CLOCKS_PER_SEC;
printf( "%f seconds\n", duration );
return 0;
}
有没有更好的方法实现计时。。