要求:0到9十个数字随机组合,但不能相同!!!

 

#include <stdio.h>

#include <iostream.h>

 

void main()

       char a[]={'0','1','2','3','4','5','6','7','8','9'};

       for(int i=0;i<10-1;i++)

      

       {

              for(int j=i+1;j<10;j++)

                     if(a[i]!=a[j])

                     {

                            cout<<a[i]<<a[j]<<"  ";

                            cout<<a[j]<<a[i]<<"  ";

                     }

              cout<<endl;

       }

}

posted on 2013-07-15 21:33  孤独的旅行  阅读(405)  评论(0编辑  收藏  举报