poj3299 Humidex

#include #include double T, D, H; double fuction(double D); void Humidex(char c1, double d1, char c2, double d2); void Humidex(char c1, double d1, char c2, double d2) { double e; if((c1=='T' && c2=='D') ||(c1=='D' && c2=='T')){ if(c1=='T'){ T=d1; D=d2; } else{ T=d2; D=d1; } H=T+fuction(D); } else if((c1=='H' && c2=='D') ||(c1=='D' && c2=='H')){ if(c1=='H'){ H=d1; D=d2; } else{ H=d2; D=d1; } T=H-fuction(D); } else{ if((c1=='H'&& c2=='T')||(c1=='T' && c2=='H')){ if(c1=='H'){ H=d1; T=d2; } else{ H=d2; T=d1; } e=(H-T)/0.5555+10.0; D=1/(1/273.16-(log(e)-log(6.11))/5417.7530)-273.16; } } } double fuction(double D) { double e, h; e=6.11*exp(5417.7530 * ((1/273.16) - (1/(D+273.16)))); h=(0.5555) * (e - 10.0); return h; } main(int argc, char* argv[]) { char c1, c2; double d1, d2; //freopen("text.txt","r", stdin); while(scanf("%c %lf %c %lf/n",&c1, &d1, &c2, &d2) && c1!='E'){ Humidex(c1, d1, c2, d2); printf("T %.1lf D %.1lf H %.1lf/n", T, D, H); } }

你可能感兴趣的:(c,include)