WOJ:Problem 1004 - Noah's Ark

很简单的,一个单位换算就可以了。

#include 
#include 
#include 
#define yz 1

double hs(double a,char *c)
{      
       double k=1.0;
       if(strcmp(c,"meters")==0)k=100.0;
       if(strcmp(c,"cubits")==0)k=45.72;
       if(strcmp(c,"feet")==0)  k=30.48;
       if(strcmp(c,"inches")==0)k=2.54;
       a=a*k;
       return (a);
           
}

int main()
{         
          double length,width,height;
          double b[2]={0.0,0.0};
          char dlength[20],dwidth[20],dheight[20];
    while(scanf("%f,&length")!=EOF)
         {
         scanf("%s",dlength);
         scanf("%f",&width);
         scanf("%s",dwidth);
         scanf("%f",&height);
         scanf("%s",dheight);
         //b[0]=hs(length,dlength);
         //b[1]=hs(width,dwidth);
         if(fabs((b[0]-b[1]))


你可能感兴趣的:(woj)