C语言中如何找到错误,C语言程序的错误查不出来啊!请各位仁兄帮忙找一下!!...

#ifdef ex_h

#define ex_h

#include

#include

#include

extern const int SIZE;

double *

#ifdef ex_h

#define ex_h

#include

#include

#include

extern const int SIZE;

double *init(int);

void reading(double *);

void product(double *);

void sort(double *,double a[],SIZE);

#endif

#define NULL 0

#define SIZE 10

void main()

{int i;

double *in_1,*in_2;

double a[SIZE];

*in_1=init(SIZE);

if(in_1==NULL)

{printf("Press any key to exit...");

getch();

exit(0);}

reading(in_1,SIZE);

product(in_1,SIZE);

sort(in_1,a,SIZE);

for(i=0;i

*in_2++=a[i]*10;

printf("\nThe numbers you've entered are:\n");

for(i=0;i

{printf("%15f",*in_1++);

if((i+1)%5==0)printf("\n");}

printf("\nThe sort of the %d numbers is:\n",SIZE);

for(i=0;i

{printf("%15f",a[i]);

if((i+1)%5==0) printf("\n");}

printf("\n10 times and opposite order is:\n");

for(i=0;i

{printf("%15f",*--in_2);

if((i+1)%5==0)printf("\n");}

printf("\nThe end!\nThank you for your use.\nPress any key to exit...");

getch();

}

#define NULL 0

double *init(int SIZE)

{double *in=(double *)calloc(SIZE,sizeof(double));

if(in!=NULL) return in;

else {printf("Failed to apply memory addresses.");

return NULL;}

}

void reading(double *in,int SIZE)

{int i;

printf("Please enter %d numbers:\n",SIZE);

for(i=0;i

{printf("the %dth number:",i+1);

scanf("%lf",in++);}

}

void product(double *in,int SIZE)

{int i;

double temp=1;

in+=SIZE-1;

for(i=0;i

temp=(*in--)*temp;

printf("The product of the %d numbers you've entered is:%f\n",SIZE,temp);

printf("Please press any key to continue...\n");

getch();

}

void sort(double *in,double a[],int SIZE)

{int i,j,k;

double temp;

for(i=0;i

a[i]=*in++;

for(i=0;i

{k=i;

for(j=i+1;j

if(a[k]>a[j]) k=j;

if(k!=i)

{temp=a[k];a[k]=a[i];a[i]=temp;}

}

}

展开

全部

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值