早教吧 育儿知识 作业答案 考试题库 百科 知识分享

POJ3299能不不帮忙看下错哪了,WA.这是我仅有的分数了,#include#includedoubleh,e;doublefun(doublex){return(int)(floor(x*10+0.5))*0.1;}doubleTD(doubletem,doubledew){e=6.11*exp(5417.7530*((1/273.16)-(1/(dew+273.16))));h=0.5555*(e-1

题目详情
POJ3299能不不帮忙看下错哪了,WA.这是我仅有的分数了,
#include
#include
double h,e;
double fun(double x)
{
return (int)(floor(x*10+0.5))*0.1;
}
double TD(double tem,double dew)
{
e=6.11*exp(5417.7530*((1/273.16)-(1/(dew+273.16))));
h=0.5555*(e-10);
return(tem+h);
}
double HD(double hum,double dew)
{
e=6.11*exp(5417.7530*((1/273.16)-(1/(dew+273.16))));
h=0.5555*(e-10);
return(hum-h);
}
double TH(double hum,double tem)
{
h=hum-tem;
e=10+h/0.5555;
return 1/(1/273.16-log(e/6.11)/5417.7530)-273.16;
}
int main()
{
char ch1,ch2;
double num1,num2,hum,tem,dew;
while(scanf("%c",&ch1)&&ch1!='E')
{
scanf("%lf %c%lf",&num1,&ch2,&num2);
if(ch1=='T'&&ch2=='D')
{
tem=num1;dew=num2;
hum=TD(tem,dew);
}
else if(ch1=='D'&&ch2=='T')
{
tem=num2;dew=num1;
hum=TD(tem,dew);
}
else if(ch1=='H'&&ch2=='D')
{
hum=num1;dew=num2;
tem=HD(hum,dew);
}
else if(ch1=='D'&&ch2=='H')
{
hum=num2;dew=num1;
tem=HD(hum,dew);
}
else if(ch1=='H'&&ch2=='T')
{
hum=num1;tem=num2;
dew=TH(hum,tem);
}
else if(ch1=='T'&&ch2=='H')
{
hum=num2;tem=num1;
dew=TH(hum,tem);
}
if(tem!=0) printf("T %.1lf D %.1lf H %.1lf\n",fun(tem),fun(dew),fun(hum));
tem=0;
}
return 0;
}
▼优质解答
答案和解析
int main()
{
char ch1,ch2;
double num1,num2,hum,tem=0,dew;
tem这里我给初始化了,运行后输入 T 1.0 D 2.0 ,有结果 “ T 1.0 D 2.0 H -0.6 ” .
看了 POJ3299能不不帮忙看下...的网友还看了以下: