> 其他 >
c++程序 编写一个函数把华氏温度转换为摄氏温度,转换格式如下: c=(f-32)*5/9
人气:269 ℃ 时间:2020-04-23 10:41:02
解答
#include
using namespace std;
void main()
{
double f,c;
coutf;
c=(f-32.0)*5.0/9.0;
cout编写函数float convert(float tempfer),参数和返回值都是float类型,实现c=(f-32)*5/9。在main()函数中实现输入、输出#include using namespace std; float convert(float tempfer) {float tempcen;tempcen=(tempfer-32.0)*5.0/9.0;return tempcen; } void main() {double f,c;cout<<"请输入华氏温度:";cin>>f;c=convert(f);cout<<“摄氏温度为:”<
推荐
猜你喜欢
© 2025 79432.Com All Rights Reserved.
电脑版|手机版