c语言错误代码4244,c语言问题

c语言问题0

我是新手,我遇到了一个问题,希望大家指点一二啊!下面是程序代码:

#include

#include

#include

#define B 1000

#define N 1000

#define A 100

void bsample(); /*函数声明*/

void sort();

main()

{

double X[N],X0,S0=0;

int i,j,m=0,S=0; /*从U[0,1]中随机产生N个样本 */

double Boot[N],T[B],X1,S1=0,W1,W2,temp,w3,w4,LEFT,RIGHT;

loop: srand((unsigned)time(NULL));

for(i=0;i

{

X[i]=(double)rand()/RAND_MAX;

}

for(i=0;i

{

S0+=X[i];

}

X0=S0/N;

for(j=0;j

{

bsample(X,Boot);

S1=0;

for(i=0;i

{

S1+=Boot[i];

}

X1=S1/N;

T[j]=X1-X0;

}

sort(T,X0);/*

for(i=0;i

for(j=0;j

if(T[j]>T[j+1])

{ temp=T[j];

T[j]=T[j+1];

T[j+1]=temp;

}

w3=T[(int)(0.025*B)-1],w4=T[(int)(0.975*B)-1];

RIGHT=X0-w3;LEFT=X0-w4;

for(m=0;m

{m=m+1;

if((0.5>LEFT)&&(0.5

S=S+1;

goto loop;

}

printf("the success times are %d\n",S);*/

/*S+=sort();

m=m+1;

if(m<1000)

goto loop;

printf("the success times are %d\n",S);*/

}

void bsample(double X[N],double Boot[N]) /*产生重复抽样样本*/

{ int i,nn;

for(i=0;i

{

nn=(int)rand()/32767.*N; /*产生0--N区间的随机数*/

Boot[i]=X[nn];

}

}

void sort(double T[B],double X0) /*排序*/

{ int i,j;double temp ,W1,W2,LEFT,RIGHT;

for(i=0;i

for(j=0;j

if(T[j]>T[j+1])

{ temp=T[j];

T[j]=T[j+1];

T[j+1]=temp;

}

W1=T[(int)(0.025*B)-1],W2=T[(int)(0.975*B)-1];

RIGHT=X0-W1;LEFT=X0-W2;/*

if((0.5>LEFT)&&(0.5

return 1;

return 0;*/

printf("%f,%f",RIGHT,LEFT);

}

我的问题是现在程序能运行,可是把注释部分也运行的话就会提示错误,编译不成功:界面如下:

Compiling...

math.c

D:\c\rr\math.c(5) : warning C4005: 'N' : macro redefinition

d:\c\rr\zuoye1.c(0) : see previous definition of 'N'

D:\c\rr\math.c(56) : error C2297: '+=' : illegal, right operand has type 'void '

D:\c\rr\math.c(68) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data

D:\c\rr\math.c(86) : warning C4098: 'sort' : 'void' function returning a value

D:\c\rr\math.c(87) : warning C4098: 'sort' : 'void' function returning a value

执行 cl.exe 时出错.

math.obj - 1 error(s), 0 warning(s)

有哪位大侠帮帮忙啊!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值