第1个回答 推荐于2017-09-14
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
int main()
{
int a[] = {3,5,7,1,4};
int n=5;
int i,j,T=1000,tmp;
srand(unsigned(time(NULL)));
while(T--)
{
i=rand()%n;
j=rand()%n;
tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
for(i=0;i<n;i++)printf("%d ",a[i]);
puts("");
return 0;
}本回答被提问者采纳