[求助]为什么A=rand();A总是等于346呢?
[求助]为什么A=rand();A总是等于346呢?
2006-07-13 21:26
2006-07-13 21:29
2006-07-13 21:56
2006-07-14 10:35
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void main()
{
int a;
srand((unsigned)time(NULL));
a=rand();
printf("%d\n",a);
}
再试试呀,这个就会每次不一样呀 ,rand()函数在0-32767之间
2006-07-14 16:39
2006-07-14 20:44