个人学习笔记1

来源:互联网 发布:模拟地理位置的软件 编辑:程序博客网 时间:2024/06/06 13:18
#include <ctime> //clock,CLOCKS_PER_SEC#include <iostream>//cin,cout,endlusing 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;}

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

原创粉丝点击