编写函数把华氏温度转换为摄氏温度,公式为:C = (F

来源:互联网 发布:重大数据研判 编辑:程序博客网 时间:2024/06/05 17:30


#include<iostream>
using namespace std;
float centigrade(float a)
{
float b;
b=5.0/9.0*(a-30);
return int(b);
}
int main()
{
float x;
cout<<"请输入华氏温度:"<<endl;
cin>>x;
cout<<"摄氏温度为:"<<centigrade(x)<<endl;
return 0;
}

阅读全文
0 0