Files
python/C++专题课程/全排列/ShjCppStudy/STL实现全排列.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

21 lines
348 B
C++

#include<bits/stdc++.h>
using namespace std;
//C++STL中全排列函数next_permutation的使用
// https://blog.csdn.net/ac_gibson/article/details/45308645
int main()
{
int a[3] = { 3,1,2 };
//快速排序
sort(a, a + 3);
//全排列
do
{
cout << a[0] << a[1] << a[2] << endl;
} while (next_permutation(a, a + 3));
return 0;
}