py15516931259
py15516931259
2016-03-26 03:02

C语言程序修改,求大神指点

2
  • c
  • 求大神指点

#include
#define n 10
void main(void)
{
int a,b,c,n;
int s[15]={0};
int l[n],i[n];
int A[n-1][15];
int h[15] = {742,752,762,772,782,792,802,812,822,832,842,852,862,872,882};
printf("请输入起点距,河底高程:\n");
scanf("%d%d",&l[n],&i[n]);
for (a=1;a<=15;a++) {
for (b=1;b<=n;b++) {
if(h[a]<=i[b] && h[a]<=i[b+1])
A[b][a]=0;
else if(h[a]>=i[a] && h[a]>=i[b+1])
A[b][a]=(l[b+1]-l[b])*(2*h[a]-i[b]-i[b+1])/2;
else if(h[a]<=i[b])
A[b][a]=(l[b+1]-l[b])*(h[a]-i[b+1])*(h[a]-i[b+1])/(i[b]-i[b+1])/2;
else
A[b][a]=(l[b+1]-l[b])*(h[a]-i[b])*(h[a]-i[b])/(i[b+1]-i[b])/2;
for (c=0;c<n-1;c++) {
s[c]=s[c]+A[b][a];
}
}
}
printf("河道断面面积",s[15]);
}
错误:
.cpp(5) : error C2059: syntax error : 'constant'

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐