编辑代码

#include <stdio.h>
int main ()
{
    //转化函数声明
    float Fah(float C);
    float Cen(float F);

   /* 局部变量定义 */ 
    float she_t,hua_f;
    char temp;

    /*选择需要转化的单位*/
    printf("请选择转化后的温度(如摄氏度 C 华氏度 F)\n<<< ");
    scanf("%c",&temp);

    /* 检查布尔条件 */
    if (temp == 'F')
    {
        printf("请输入摄氏度值\n<<<");
        scanf ("%f",&she_t);
        hua_f = Fah(she_t);
        printf("华氏度:%.1f F",hua_f);
    }
    else
    {
        printf("请输入华氏度值\n<<<");
        scanf ("%f",&hua_f);
        she_t = Cen(hua_f);
        printf("摄氏度:%.1f C",she_t);

    }
    
	return 0;
}
    /*摄氏度温度转化为华氏度温度*/
    float Fah(float C)
    {
    float hua_f ;
    hua_f = C*1.8+32;    
    return hua_f;
    }
 
    /*华氏度温度转化为摄氏度温度*/
    float Cen(float F)
    {
        float she_t ;
        she_t = (5.0/9)*(F-32);
        return she_t;
    }