答案 0 :(得分:2)
您可以在C程序中测量代码的时间。
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main() {
clock_t start = clock();
int n = 100;
int i=0;
while(i<100*n)
i++;
clock_t stop = clock();
double elapsed = (double) (stop - start) / CLOCKS_PER_SEC;
printf("\nTime elapsed: %.5f\n", elapsed);
return 0;
}