所以我已经设定了使用以下等式在C++中创建温度转换器的任务:
Celsius = (5/9)*(Fahrenheit – 32)
Run Code Online (Sandbox Code Playgroud)
到目前为止,我已经提出了这个问题(我从一开始就删除了10行评论,所以代码发布在第11行,如果这有任何意义)
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
float celsius;
float farenheit;
std::cout << "**************************" << endl;
std::cout << "*4001COMP-Lab5-Question 1*" << endl;
std::cout << "**************************" << endl << endl;
std::cout << "Please enter a temperature in farenheit: ";
std::cin >> farenheit >> endl;
std::cout << "Temperature (farenheit): " << endl;
std::cout << "Temperature (celsius): " << celsius << endl;
std::cin.get();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
每当我尝试运行这个程序时,每次都会出现一堆错误:
1> …