Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

帮我看一下 代码吧~ 不知道到底错在哪了 老wa

Posted by hf01728 at 2010-07-19 00:32:45 on Problem 3299
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
const double F1=5417.7530;
const double F2=273.16;
const double F3=0.5555;
double e,h; 
 void TD(double temperature,double dewpoint){
       e=6.11*exp(F1*((1/F2)-(1/(dewpoint+F2))));
       h=F3*(e-10.0);
       double humidex=temperature+h;
       printf("T %.1lf D %.1lf H %.1lf\n",temperature,dewpoint,humidex);
       }
 void TH(double temperature,double humidex){
       h=humidex-temperature;
       e=10.0+h/F3;
       double dewpoint=1.0/(1.0/F2-log(e/6.11)/F1)-F2;
       printf("T %.1lf D %.1lf H %.1lf\n",temperature,dewpoint,humidex);
       }
 void DH(double dewpoint,double humidex){
       e=6.11*exp(F1*((1/F2)-(1/(dewpoint+F2))));
       h=F3*(e-10.0);
       double temperature=humidex-h;
       printf("T %.1lf D %.1lf H %.1lf\n",temperature,dewpoint,humidex);
       }
       
int main()
{
    char letter1,letter2;
    double a,b;
    while(cin>>letter1&&letter1!='E'){
        cin>>a>>letter2>>b;
        if(letter1=='T'){
            if(letter2=='D')TD(a,b);
            else TH(a,b);}
        else if(letter1=='D'){
            if(letter2=='T')TD(b,a);
            else DH(a,b);}
        else {
            if(letter2=='T')TH(b,a);
            else DH(b,a);}
        }
    return 0;
}


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator