当前位置: 代码迷 >> C语言 >> 帮忙看看,求助!!!!!!!!!!!!~~~~~
  详细解决方案

帮忙看看,求助!!!!!!!!!!!!~~~~~

热度:368   发布时间:2008-06-14 00:06:37.0
帮忙看看,求助!!!!!!!!!!!!~~~~~
有没有哪位高手能不能帮我看看哪里错了.....自己快不行了~~~
#include<time.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define paitheo=3.1415926
int main()
{
double x,y,z,er,paical;
long hit,cool=0,bad=0,i;
printf("please choose a number from (100,1000,10000,100000)\n");
scanf("%ld",&hit);
if(hit=100==0)
printf("Please input a right number again!\n");
else if(hit=1000==0)
printf("Please input a right number again!\n");
else if(hit=10000==0)
printf("Please input a right number again!\n");
else if(hit=100000==0)
printf("Please input a right number again!\n");
else
{
randomize();
for(i=1;i<=hit;i++)
{
x=rand()/(double)(RAND_MAX+1);
y=rand()/(double)(RAND_MAX+1);
if(x*x+y*y<=1)
cool++;
else
bad++;
}
z=4*(double)cool/(double)hit;
printf("paical=%f\n",z);
er=fabs(1-z/(double)paitheo)*100;
printf("the number of hits=%ld\n",hit);
printf("cool=%ld\n",cool);
printf("bad=%ld\n",bad);
printf("paical=%f\n",paical);
printf("er=%.2f%\n",er);
}
return;
}
----------------解决方案--------------------------------------------------------
#define paitheo=3.1415926
ms不用'='号吧!
别的没看
----------------解决方案--------------------------------------------------------
  相关解决方案