#include
#include
#include
const double e = 2.718281828;
double TD(double* first, double*second){
double third;
double ex = 6.11* pow(e,(5417.7530*((1/273.16) - (1/(*second+273.16)))));
double h = (0.5555)*(ex - 10.0);
third = *first + h;
return(third);
}
double TH(double * first, double *second){
double third;
third = 1/((1/273.16)-log(((*second - *first)/0.5555 + 10.0)/6.11)/5417.7530) - 273.16;
return(third);
}
double DH(double * first, double * second){
double third;
double ex = 6.11* pow(e,(5417.7530*((1/273.16) - (1/(*first+273.16)))));
double h = (0.5555)*(ex - 10.0);
third = *second - h;
return (third);
}
typedef struct TDH{
double Temp;
double Dew;
double Humi;
}HumiSet;
int main(){
HumiSet resultSet[10000];
HumiSet once;
double first;
double second;
char sig1, sig2;
int flag = 0;
while(scanf("%c",&sig1) && sig1 != 'E'){
scanf("%lf %c %lf",&first, &sig2, &second);
getchar(); //作用不清楚啊
if(sig1 == 'T' && sig2 == 'D'){
once.Humi = TD(&first, &second);
once.Temp = first;
once.Dew = second;
}
if(sig1 == 'D' && sig2 == 'T'){
once.Humi = TD(&second, &first);
once.Temp = second;
once.Dew = first;
}
if(sig1 == 'T' && sig2 == 'H'){
once.Dew = TH(&first, &second);
once.Temp = first;
once.Humi = second;
}
if(sig1 == 'H' && sig2 == 'T'){
once.Dew = TH(&second, &first);
once.Temp = second;
once.Humi = first;
}
if(sig1 == 'D' && sig2 == 'H'){
once.Temp = DH(&first, &second);
once.Dew = first;
once.Humi = second;
}
if(sig1 == 'H' && sig2 == 'D'){
once.Temp = DH(&second, &first);
once.Dew = second;
once.Humi = first;
}
resultSet[flag++] = once;
}
int i = 0;
while (i printf("T %.1f D %.1f H %.1f\n",resultSet[i].Temp,resultSet[i].Dew,resultSet[i].Humi);
i++;
}
return(0);
}
阅读(865) | 评论(0) | 转发(0) |