Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:我的代码是这样的,为什么。。。。In Reply To:我的代码是这样的,为什么。。。。 Posted by:LittleCarol at 2009-07-03 15:33:56 > #include <stdio.h> > #include <math.h> > > int main() > { > float humidex, temperature, dewpoint; > float h, e; > > char c1, c2; > float tmp1, tmp2; > while(scanf("%c", &c1), c1!='E') > { > > scanf("%f %c %f", &tmp1, &c2, &tmp2); > switch(c1+c2) > { > case 'T'+'D': > temperature = (c1 == 'T')?tmp1:tmp2; > dewpoint = (c1 == 'D')?tmp1:tmp2; > e = (float)(6.11 * exp(5417.753 * ((1/273.16) - (1/(dewpoint + 273.16))))); > h = (float)(0.5555 * (e - 10.0)); > humidex = temperature + h; > break; > case 'T'+'H': > temperature = (c1 == 'T')?tmp1:tmp2; > humidex = (c1 == 'H')?tmp1:tmp2; > h = (humidex - temperature); > e = (float)(h/0.5555 + 10.0); > dewpoint = 1/((1/273.16) - (log(e/6.11))/5417.753) - 273.16; > break; > case 'H'+'D': > humidex = (c1 == 'H')?tmp1:tmp2; > dewpoint = (c1 == 'D')?tmp1:tmp2; > e = (float)(6.11 * exp(5417.753 * ((1/273.16) - (1/(dewpoint + 273.16))))); > h = (float)(0.5555 * (e - 10.0)); > temperature = humidex - h; > break; > default: > break; > > } > printf("T %.1f D %.1f H %.1f\n", temperature, dewpoint, humidex); > scanf("%c", &c1);//为什么一定要加这一句呢?这里才c1得到的是一个回车符 > > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator