标签:style blog color io os ar sp div art
clock()主要用来计算一个事件持续的时间
1 //该程序计算一个时间持续的时间 2 #include <iostream> 3 #include <time.h> 4 #include <stdlib.h> 5 6 using namespace std; 7 8 int main() 9 { 10 clock_t start, finish; 11 start = clock(); 12 cout << (double)start / CLOCKS_PER_SEC << endl; 13 int i = 10000000; 14 while(i--); 15 finish = clock(); 16 cout << (double)finish / CLOCKS_PER_SEC << endl; //将结果转化为以秒为单位 17 return 0; 18 }
标签:style blog color io os ar sp div art
原文地址:http://www.cnblogs.com/DamonBlog/p/4011787.html