[cpp] view plaincopyprint?/* Note:Your choice is C IDE */
#include "stdio.h"
#include "stdlib.h"
#define N 25
main()
{
int i,j,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,students[i]);
}
}
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "stdlib.h"
#define N 25
main()
{
int i,j,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,students[i]);
}
}
0805
最新推荐文章于 2015-11-12 16:58:05 发布