代码计算程序运行的时间

为了计算程序运行的时间

#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;


}

 

相关文章:

  • 2022-12-23
  • 2021-07-24
  • 2022-01-15
猜你喜欢
  • 2022-12-23
  • 2021-07-18
  • 2021-09-05
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案