📄 perm.cpp
字号:
#include <iostream>
using namespace std;
template <class Type>
inline void Swap(Type &a, Type &b)
{
Type temp = a;
a = b;
b = temp;
}
template <class Type>
void Perm(Type list[], int k, int m)
{
int i;
if(k==m){
for(i=0; i<=m; i++)
cout<<list[i];
cout<<endl;
}
else
for(i=k; i<=m; i++){
Swap(list[k], list[i]);
Perm(list, k+1, m);
Swap(list[k], list[i]);
}
}
int main()
{
char list[3]={'1','[','3'};
Perm(list, 0, 2);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -