产生随机数遇到点问题 想问问是不是编译器不兼容问题引起的
#include <stdio.h>#include <math.h>
int main()
{
double x,y,pi;
int n,s;
n = s = 0;
while(s<=1000000)
{
x = rand()/32767.0;
y = rand()/32767.0;
if((x*x + y*y)<1)
n++;
s++;
}
pi = (4.0*n)/1000000;
printf("\n圆周率约等于:%lf",pi);
return 0;
}
--------------------------------------------------
D:\: error C2065: 'rand' : undeclared identifier
--------------------------------------------------
请帮忙解答