该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
#include
int main(void)
{
int a[]={1,2,3,4,5,6,7,8};
int b[]={9,10,11,12,13,15};
int lena,lenb,randa,randb,randtimes;
int i,temp;
srand((unsigned)time(NULL));
lena = sizeof(a)/sizeof(int);
lenb = sizeof(b)/sizeof(int);
randtimes = rand()%(lena
printf(" a: ");
for (i=0;i
printf("%d ",a[i]);
printf("\n b: ");
for (i=0;i
printf("%d ",b[i]);
printf("\n\n");
for (i=0;i
{
randa=rand()%lena;
randb=rand()%lenb;
temp = a[randa];
a[randa] = b[randb];
b[randb] = temp;
}
printf("随机交换%d次后的a: ",randtimes);
for (i=0;i
printf("%d ",a[i]);
printf("\n随机交换%d次后的b: ",randtimes);
for (i=0;i
printf("%d ",b[i]);
printf("\n");
return 0;
}