第1个回答 2015-10-23
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int sum = 0;
int loops = 100000000;
clock_t start, end;
start = clock(); //记录开始时间
while (loops--)
sum += 1;
end = clock(); //结束时间
printf("%d loops spend %lf s", 1000000,(double)(end - start) / CLOCKS_PER_SEC);
return 0;
}