1.time(NULL) 计时最小单位为s
2.time.h
int main() { clock_t start, end; start = clock(); end = clock(); printf("%f",(float)(end-start)/CLK_TCK); }
3.windows.h 显示ms数
DWORDstart,end; start= GetTickCount(); //…calculating… end= GetTickCount(); printf("time=%d ",end-start);