#include<stdio.h> #include<stdlib.h> #include<time.h> //测试for循环时间 void delay(unsigned int t) { unsigned int i,j; for(i=0;i<t;i++) for(j=0;j<t;j++) ; } int main( ) { clock_t start, finish; double Text_time; start = clock(); delay(1000); finish = clock(); Text_time = (double)(finish-start) / CLOCKS_PER_SEC; printf("%lf seconds/n", Text_time); return 0; }
原文地址:https://www.cnblogs.com/1138720556Gary/p/9703470.html
时间: 2024-11-15 01:07:00