unsigned int CelToFah(unsigned int CelEquVal) { return (unsigned int )(CelEquVal * 9 / 5 + 32);//小数点小于0.5的运算 } unsigned int CelToFahAdd(unsigned int CelEquVal) { return (unsigned int )((CelEquVal * 9 / 5 + 32)+1);//小数点大于等于0.5的运算 } unsigned int C_TO_F(unsigned int C) { unsigned int FahEquVal; if(((C* 9 *10/ 5 ) %10)>4 ) { FahEquVal = CelToFahAdd(C);//小数点大于等于0.5的运算 } else { FahEquVal = CelToFah(C);//小数点小于0.5的运算 } return FahEquVal; } unsigned int F_TO_C(unsigned int F) { return ((F-32)*5)/9; }