#include "stdio.h"
#define N 25
main()
{ int i;
int j;
int temp;
int students[N];
for(i=0;i<N;i++){
temp=rand()%45+1;
if(i>0){
for(j=0;j<=i-1;j++){
if(temp==students[j]){
temp=rand()%45+1;
j=-1;}
}
}
students[i]=temp;
printf("the %d student no is %d\n",i,temp);
}
}
45人中随机抽取25人不重复
最新推荐文章于 2022-09-24 15:58:30 发布