我在网上搜索了,但只找到了一种方法能做到这一点,但是用这种方法返回的时间单位是秒而不是毫秒。
我的代码如下:
#include <stdio.h>
#include <assert.h>
#include <time.h>
int main(void)
{
int solucion;
time_t start, stop;
clock_t ticks;
long count;
time(&start);
solucion = divisores_it(92000000, 2);
time(&stop);
printf("Finnished in %f seconds. \n", difftime(stop, start));
return 0;
}
C
而不是C++
。你的建议需要使用C++
。 - rbaleksandar