VS2008编译C代码,不识别randomize()函数
程序代码:
#include #include #include #include #define N 30000 void main() { double e=0.1,b=0.5,c,d; long int i; float x,y; int c2=0,d2=0; puts("*********************************************"); puts("\n >> Result of Regular Polygon Approximating:"); for(i=6;;i*=2) { d=1.0-sqrt(1.0-b*b); b=0.5*sqrt(b*b+d*d); if(2*i*b-i*e<1e-15) break; e=b; } printf("------------------------------------------"); printf(" >> pi=%.15lf\n",2*i*b); printf(" >> The number of edges of required polygon:%ld\n",i); printf("------------------------------------------"); randomize(); while(c2++<=N) { x=random(101); x=random(101); if(x*x+y*y<=10000) d2++; } puts("\n >> Result of Random Number Method:"); printf("------------------------------------------"); printf(" >> pi=%f\n",4.*d2/N); printf("------------------------------------------"); puts("\n Press any key to quit..."); getch(); }