#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#define NUM 7
int main()
{
int student[NUM];
int i,o,p;
srand((unsigned)time(NULL));
for(i=1;i<=NUM;i++){
o=(rand()%45)+1;
for(p=1;p<=i-1;p++){
if(o==student[p]){
o=(rand()%45)+1;
}
}
student[i]=o;
printf("the student the %dth called is :%d\n",i,student[i]);
}
return 0;
}
用数组储存学号且学号不重复
最新推荐文章于 2022-12-18 17:21:42 发布