代码计算程序运行的时间

代码计算程序运行的时间

为了计算程序运行的时间

#include<bits/stdc++.h>
using namespace std;
#include<ctime>

void func1(){
    int a[]={1,2,3};
    do{
        for (int i = 0; i <= 2; i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<endl;
    }while(next_permutation(a,a+3));
}


int main(){
    clock_t start,end;
    start=clock();
    func1();
    end=clock();
    cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;


}

 

因上求缘,果上努力~~~~ 作者:每天卷学习,转载请注明原文链接:https://www.cnblogs.com/BlairGrowing/p/13701041.html

原文地址:https://www.cnblogs.com/BlairGrowing/p/13701041.html