关于随机数
int mark[100],overn(0),i; double aver(0);
srand((unsigned)time(NULL));
for (i=0;i<100;i++)
{
mark[i] = int(rand()%101);
aver += mark[i];
}
aver=aver/100;
for(i=0;i<100;i++)
if(mark[i]>=aver)
overn++;
与
int mark[100],overn(0),i;
double aver(0);
for (i=0;i<100;i++)
{
srand((unsigned)time(NULL));
mark[i] = int(rand()%101);
aver += mark[i];
}
aver=aver/100;
for(i=0;i<100;i++)
if(mark[i]>=aver)
overn++;
两者的区别的原因是什么?