记录时间的方法
枫林晚
2018-04-14 21:49:43
https://blog.csdn.net/xiong452980729/article/details/51394036
```cpp
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
clock_t startTime,endTime;
startTime = clock();
for (int i = 0; i < 1000000; i++)
{
i++;
}
endTime = clock();
cout << "Totle Time : " <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;
system("pause");
return 0;
}
```
```cpp
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
for (int i = 0; i < 1000000; i++)
{
i++;
}
cout << "Totle Time : " << (double)clock() /CLOCKS_PER_SEC<< "s" << endl;
system("pause");
return 0;
}
```