大佬,帮我看看这里咋改,谢谢!
循环那部分咋改?#include<stdio.h>
#include<stdbool.h>
void Teperatures(double tp);
int main(void)
{
char tF;//华氏温度
while(true)
{
printf("Please enter a tF:\n");
scanf("%c",&tF);
if(48<=tF && tF>=57)//判断如果不是数字,退出循环
{
printf("error\n");
break;
}
Teperatures(tF);
}
return 1;
}
void Teperatures(double tp)
{
const float S_PER_P=32.0,S_PER_M=273.16;
double tC,tK;//摄氏温度,开氏温度
tC=5.0/9.0*(tp-S_PER_P);
tK=tC+S_PER_M;
printf("The tC=%.2lf,tK= %.2lf.\n",tC,tK);
}