#include <iostream>  
using namespace std;  
  
template <typename T>  
void Perm(T a[], int k, int m)  
{  
    if(k==m)  
    {  
        for(int i=0; i<=m; i++)  
            cout<<a[i];  
        cout<<endl;  
    }  
    else  
    {  
        for(int i=k; i<=m; i++)  
        {  
            swap(a[k], a[i]);  
            Perm(a, k+1, m);  
            swap(a[k], a[i]);  
        }  
    }  
}  
  
void main()  
{  
    int a[]={1,2,3,4,5};  
    char b[]="abcde";  
    Perm(b, 0, 4);  
}  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-08-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-24
  • 2021-11-17
  • 2021-07-01
  • 2021-07-14
  • 2022-12-23
相关资源
相似解决方案