以A,B,C为例
1 # include<iostream> 2 using namespace std; 3 int main() 4 { 5 char c1,c2,c3; 6 for (c1='A'; c1<='C'; ++c1) 7 for (c2='A'; c2<='C'; ++c2) 8 if (c1 ==c2) continue; 9 else for (c3='A'; c3<='C'; ++c3) 10 if ((c3==c1||c3==c2)) 11 continue; 12 else cout << c1 <<c2<<c3<<endl; 13 }