真的,刚开始就是想用这个程序来测一测cpu的性能,然而又被现实打脸,每次结果都不一样,QAQ。
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void)
{
clock_t start = 0,end = 0;
double cpu_time = 0;
start = clock();
int a = 0;
for(;a <= 100000;a++)
printf("\n%d",a);
printf("\nWe have finished.");
end = clock();
cpu_time = (double)(end - start) / CLOCKS_PER_SEC;
printf("\n%f seconds.\n",cpu_time);
system("pause");
return 0;
}