| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 482 人关注过本帖
标题:请问这段C语言错在哪里 我做了半天看不出来~~求助
只看楼主 加入收藏
天涯浪子波
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-7-9
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
请问这段C语言错在哪里 我做了半天看不出来~~求助
#include<stdio.h>
#include<math.h>
main()
{long i,j,q[8][8]={{27767,47,161,546,2342,4301,361,2988},
{10691,25019,28406,554,4241,1674,167,1325},
{11040,25622,14071,379,2803,1798,768,2347},
{422,14059,34956,4179,239,122,473,4065},
{5483,6369,18983,394,27249,1112,7678,583},
{12019,14897,14090,117,1480,45841,1624,1542},
{3921,15277,10493,3,305,916,10139,1315},
{16901,1787,5857,24,383,350,405,17928}};
double m[8][8],o[8],d[8],c[8][8]={{500,1548.559,3223.024,5244.06,3754.168,2027.582,4107.792,3098.774},
{1548.559,500,1685.804,3698.024,2930.455,3340.33,5602.275,3658.125} ,
{3223.024,1685.024,500,2027.54,3150.242,4905.653,7188.254,4596.633},
{5244.06,3698.024,2027.54,500,4030.032,6760.261,9204.205,6343.06},
{3754.168,2930.455,3150.242,4030.032,500,3777.976,7605.603,6546.65},
{2027.582,3340.33,4905.653,6760.261,3777.976,500,4253.506,5090.282},
{4107.792,5602.275,7188.254,9204.205,7605.603,4253.506,500,3909.862},
{3098.774,3658.125,4596.633,6343.06,6546.65,5090.282,3909.862,500}};
for(i=0;i<8;i++)
{o[i]=0;
for(j=0;j<8;j++)
o[i]=o[i]+q[i][j];
}
for(j=0;j<8;j++)
{d[j]=0;
for(i=0;i<8;i++)
d[j]=d[j]+q[i][j];
}
for(i=0;i<8;i++)
for(j=0;j<8;j++)
m[i][j]=0.00104*pow(o[i]*d[j],1.085)/pow(c[i][j],1.112);
for(i=0;i<8;i++)
for(j=0;j<8;j++)
{if(j==7)
printf("\n");
printf("%f",m[i][j]);
}
for(i=0;i<8;i++)
for(j=0;j<8;j++)
{printf("q%d%d=0.00104*(%f*%f)^1.085/(%f^1.112)=%f",i,j,o[i],d[j],c[i][j]);
printf("\n");
}
}
搜索更多相关主题的帖子: C语言 
2009-08-20 18:35
soler
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
帖 子:181
专家分:1077
注 册:2005-7-16
收藏
得分:10 
编译没什么问题啊,只是你最后一句输出多了一个%f,看看你的printf函数参数是不是少写了一个。。。
2009-08-20 18:46
★红狼
Rank: 2
等 级:论坛游民
帖 子:190
专家分:17
注 册:2006-7-12
收藏
得分:10 
{o[i]=0  只赋值了第一位
o[i]=o[i]+q[i][j]; //o数组里 没有数值。你的+起来后等于什么?
2009-08-20 19:13
快速回复:请问这段C语言错在哪里 我做了半天看不出来~~求助
数据加载中...
 
   



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

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