高手帮忙看一下--结果输出问题
程序为何解不出t,v和m的值?程序如下:#include<stdio.h>
#include<iostream.h>
#include<math.h>
void main()
{
int i,j;
double p,t,m,v; // p为密度,t为温度,m为质量流量
double b={20,25,30,35,40,45,50,55,60,65,70,75,80},G={697.78,705.04,708.51,708.15,703.98,696.02,684.33,669.03,650.23,628.11,602.86,574.72,543.96}; //输入角度和G
double cp=1005,ta=293,pa=1.205,ycol=0.6,a=1378,Hchi=123,h=10,L=1501,Achi=2290.2;
double f=0.008428,ein=0.056;//损失系数
//double f=0.056,ein=1.5;//损失系数
double D=54;//D为集热棚的水力直径
double Acol=0.5*a*a;
for(j=0;j<13;j++)
{
//t=300,p=1.0,m=10000,v=1.0; //赋初值
t=0,p=1.0,m=10000,v=1.0; //赋初值
int n=0;
for(i=0;1;i++)
{
//```````````````````````方程的迭代格式``````````````````````````````````````````````//
t=(ycol*Acol/cp)*G/m+ta;
p=2.2204-0.00353*t;
m=p*v*Achi;
v=sqrt((2*(pa-p)*9.8*(Hchi+0.5*a*sin(b*3.1415926/180))-0.5*f*L*p*pow(v,2)/D-0.5*ein*pa*pow((m/a/h),2))/p);
//```````````````````````````````````````````````````````````````````````````````````//
if((fabs(t-t)<10e-6) && (fabs(p-p)<10e-6)&&(fabs(m-m)<10e-6)&&(fabs(v-m)<10e-6))// 判断跌代的值
break;
n++;
}
printf("%f\t",p);
printf("%f\t",t);
printf("%f\t",v);
printf("%f\t",m);
printf("\n");
}
}
[ 本帖最后由 风花雪月 于 2008-4-9 08:24 编辑 ] 是否有什么提示? 你的程序在vc中错误很多。我想帮助你,但是太多错误了。你先调试一下吧。
页:
[1]