#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;
}