hour05_2.cpp
来自「《24学时精通c++》的随书源码的下半部分。欢迎下载学习。」· C++ 代码 · 共 25 行
CPP
25 行
#include <iostream>
// this is actually a very simple problem -- change the names around and reverse
// the formula!
float Convert(float);
int main()
{
float TempFer;
float TempCel;
std::cout << "Please enter the temperature in Celsius: ";
std::cin >> TempCel;
TempFer = Convert(TempCel);
std::cout << "\nHere's the temperature in Fahrenheit: ";
std::cout << TempFer << std::endl;
return 0;
}
float Convert(float TempCel)
{
float TempFer;
TempFer = TempCel * 9 / 5 + 32;
return TempFer;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?