C++实验02(02)华氏温度转换为摄氏温度

题目描述
编写一个函数convert()把华氏温度转换为摄氏温度,转换公式为:
C=(F-32)* 5 /9
要求用内联函数实现。在main()中调用该函数。
说明:F为double型
输入描述
华氏温度
输出描述
摄氏温度
输入样例
100
输出样例
华氏温度为:100,对应的摄氏温度为:37.7778(中文标点)

#include <iostream>
using namespace std;
inline double f(double h )
{
    
    
	return (h-32)*5/9  ;
}


int main()
{
    
    
	double h=0;
	cin>>h;
	cout<<"华氏温度为:"<<h<<",对应的摄氏温度为:"<<f(h);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_44179485/article/details/105890629