#include <iostream>
#include 
<stdlib.h>

using namespace std;

int main()
{
    
int aTest[10= {0123456789};
    
    
int nPos, nTemp;

    srand((unsigned)time(NULL));

    
for(int nCount = 0; nCount < 10; nCount ++)
    {
        nPos 
= rand()%10;
        nTemp 
= aTest[nPos];
        aTest[nPos] 
= aTest[nCount];
        aTest[nCount] 
= nTemp;

        cout 
<< aTest[nCount]<< endl;
    }
    
return 0;
}

 

 //基于交换位置,所以不可能重复

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-12-31
  • 2021-10-16
  • 2021-11-30
  • 2022-12-23
  • 2021-08-30
猜你喜欢
  • 2022-12-23
  • 2021-09-21
  • 2021-06-24
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案