#include
#include
#include  

int main()
{
    int choice, feet, pound;
    double cm,inches, kg, ounce; 
 
    printf("1.Convert centimeters to feet and inches.\n");
    printf("2.Convert feet and inches to centimeters.\n");
    printf("3.Convert kilograms to pounds and ounces.\n");
    printf("4.Convert pounds and ounces to kilograms.\n\n");
    printf("Please make a choice : ");   
        
    scanf("%i",&choice);
  
    if( choice == 1 )
    {
        printf("請輸入__公分 : ");
        scanf("%lf",&cm); 
                
        feet = (cm / 2.54) / 12;
        inches = (cm / 2.54) - (feet * 12);
       
        printf("\n%d feet %lf inches \n",feet,inches); 

        system("PAUSE");         
        return 0;    
    }  
    
    if( choice == 2 )
    {
        printf("請輸入__英尺__英吋 : ");
        scanf("%d %lf", &feet, &inches); 
                
        cm = (feet * 12 + inches) * 2.54;
       
        printf("\n%lf cm\n",cm); 

        system("PAUSE");         
        return 0;    
    } 
    
    if( choice == 3 )
    {
        printf("請輸入__公斤 : ");
        scanf("%lf", &kg); 
                
        pound = (kg * 2.2 * 16) / 16;
        ounce = (kg * 2.2 * 16) - (pound * 16);
       
        printf("\n %d pound %lf ounce", pound, ounce); 

        system("PAUSE");         
        return 0;    
    }   
    
    if( choice == 4 )
    {
        printf("請輸入__磅__盎司 : ");
        scanf("%d %lf", £, &ounce); 
                
        kg = (pound * 16 + ounce) / 2.2 / 16;
       
        printf("\n%lf kg", kg); 

        system("PAUSE");         
        return 0;    
    }    
    
    
    system("PAUSE");    
    return 0;
}
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 illimite 的頭像
    illimite

    酷愛自由

    illimite 發表在 痞客邦 留言(0) 人氣()