#include #include using namespace std;

int main() { int arr[] = {1, 2, 3}; int n = sizeof(arr) / sizeof(arr[0]);

do {
    for (int i = 0; i < n; i++) {
        cout << arr[i] << " ";
    }
    cout << endl;
} while (next_permutation(arr, arr + n));

return 0;

}

对于123的排列想必大家都知道有6种排列方式分别是:123132213231312321如果想知道某个排列方式的下一个是多少请用编程实现。例如:123的下一个排列是132请用c++写一份程序代码

原文地址: https://www.cveoy.top/t/topic/ewJq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录