| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 374 人关注过本帖
标题:帮忙看看,求助!!!!!!!!!!!!~~~~~
只看楼主 加入收藏
wj54047395
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-6-14
收藏
 问题点数:0 回复次数:1 
帮忙看看,求助!!!!!!!!!!!!~~~~~
有没有哪位高手能不能帮我看看哪里错了.....自己快不行了~~~
#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;
}
2008-06-14 00:06
himpo
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:192
专家分:123
注 册:2008-5-16
收藏
得分:0 
#define paitheo=3.1415926
 ms不用'='号吧!
别的没看
2008-06-14 08:34
快速回复:帮忙看看,求助!!!!!!!!!!!!~~~~~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023532 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved