个人学习笔记1

#include <ctime> //clock,CLOCKS_PER_SEC
#include <iostream>//cin,cout,endl
using namespace std;

int main()
{
    double start = clock(); 
    //DO SOMETHING  
    int a[100];
    for (int i = 0; i < 100; i++)
    {
        a[i] = rand();
        cout << a[i];
    }
    cout << endl;
    cout << "花了多少时间?" << endl;
    double endtime = clock();
    cout << (endtime - start) / CLOCKS_PER_SEC;
    int c;
    cin >> c;
    return 0;
}

经过多次测验,运行时间长度竟然不一样???

猜你喜欢

转载自blog.csdn.net/sinat_39028599/article/details/72967584
今日推荐