#include
const a=1.80,b=32.00,c=273.16;
void temperateure(double n);
int main(void)
{
double fahrenheit,celsius,kelvin;
printf("input fahrenheit.q or no number letter to quit\n");
scanf("%f",&fahrenheit);
while(scanf("%f",&fahrenheit)==1)
{
temperature(fahrenheit);
printf("%.2f.\n %.2f.\n %.2f.\n",fahrenheit,celsius,kelvin);
scanf("%f",&fahrenheit);
}
printf("wrong\n");
return 0;
}
void temperateure(double fahrenheit)
{
celsius=a*fahrenheit+b;
kelvin=celsius+c;
return 0;
}
程序错误 c语言初学者求教
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- threenewbee 2016-05-23 09:28关注
const a=1.80,b=32.00,c=273.16;
->
const double a=1.80,b=32.00,c=273.16;void temperateure(double n);
->
void temperature(double n);
下面还有一个地方也要修改好多错误,直接给你修改了下
#include<stdio.h> const double a=1.80,b=32.00,c=273.16; void temperature(double fahrenheit, double & celsius, double & kelvin); int main(void) { double fahrenheit,celsius,kelvin; printf("input fahrenheit.q or no number letter to quit\n"); scanf("%f",&fahrenheit); while(scanf("%f",&fahrenheit)==1) { temperature(fahrenheit,celsius,kelvin); printf("%.2f.\n %.2f.\n %.2f.\n",fahrenheit,celsius,kelvin); scanf("%f",&fahrenheit); } printf("wrong\n"); return 0; } void temperature(double fahrenheit, double & celsius, double & kelvin) { celsius=a*fahrenheit+b; kelvin=celsius+c; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 TI的insta-spin例程
- ¥15 完成下列问题完成下列问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换
- ¥15 YoloV5 第三方库的版本对照问题
- ¥15 请完成下列相关问题!
- ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
- ¥15 求daily translation(DT)偏差订正方法的代码
- ¥15 js调用html页面需要隐藏某个按钮
- ¥15 ads仿真结果在圆图上是怎么读数的
- ¥20 Cotex M3的调试和程序执行方式是什么样的?