C++中编写一个函数把华氏温度转换为摄氏温度,转换公式为:C=(f_32)*5/9。

#include<iostream>usingnamespacestd;//函数声明intmain(){floatTempFer;floatTempCel;cout<<"... #include <iostream>
using namespace std;
//函数声明
int main()
{
float TempFer;
float TempCel;
cout<<"Please enter the temperature in Fahrenheit:";
cin>>TempFer;
TempCel= //函数调用
cout<<"\nHere's the temperature in Celsius:";
cout<<TempCel<<endl;
return 0;
}

_______________Convert(float TempFer)
{
float TempCel;
TempCel=((TempFer-32)*5)/9}

将函数的定义和main函数交换位置后,哪句代码可以省略?
展开
 我来答
_c_guoke
2012-03-05 · TA获得超过197个赞
知道答主
回答量:38
采纳率:0%
帮助的人:19.2万
展开全部
#include <iostream>
using namespace std;

float Convert(float TempFer)
{
float TempCel;
TempCel=((TempFer-32)*5)/9;
return TempCel;
} //函数声明
int main()
{
float TempFer;
float TempCel;
cout<<"Please enter the temperature in Fahrenheit:";
cin>>TempFer;
TempCel= Convert(TempFer); //函数调用
cout<<"\nHere's the temperature in Celsius:";
cout<<TempCel<<endl;
return 0;
}
主函数里函数声明可以省略
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式