帮忙看一下这个程序错误在哪?调试不出来~~
#include <stdio.h> #include <stdlib.h>
#include <math.h>
void main()
{
int i,j; long int s;
double x,mean,sigma;
double gauss(double,double,long int *);
mean=0.0; sigma=1.0;s=13579;
for(i=0;i<10;i++)
{
for(j=0;j<5;j++)
{
x=gauss(mean,sigma,&s);
printf("%13.7f",x);
}
printf("\n");
}
}
double gauss(mean,sigma,s)
double mean,sigma;
long int *s;
{
int i;double x,y;
double uniform();
for(x=0,i=1;i<12;i++)
x+=uniform(0.0,1.0,s);
x=x-6.0;
y=mean+x*sigma;
return(y);
}
double uniform(a,b,seed)
double a,b;
long int *seed;
{
double t;
*seed=2045*(*seed)+1;
*seed=*seed-(*seed)*1048576;
t=(*seed)/1048576.0;
t=a+(b-a)*t;
return(t);
}