标签:
#include <iostream> #include <time.h> int main(void) { int sum = 0; time_t t,t1; time(&t); //t = time(NULL); std::cout<<ctime(&t); //单位为秒 int star = clock(); //单位毫秒 for (int i=1; i <=10000; ++i) { sum = sum+i; } std::cout<<sum<<std::endl; int stop = clock(); std::cout<<stop - star<<"毫秒"<<std::endl; time(&t1); int t3 = t1-t; std::cout<<t3<<" 秒"<<std::endl; std::cout<<ctime(&t1); system("pause"); return 0; }
标签:
原文地址:http://www.cnblogs.com/lwngreat/p/4268505.html