【发布时间】:2021-02-10 11:25:48
【问题描述】:
#include <iostream>
#include <conio.h>
int main()
{
int C; //let C be Celsius
int F; //let F be Fahrenheit
cout << "Enter the temperature in Celsius: ";
cin >> C;
cout << "Enter the temperature in Fahrenheit: ";
cin >> F;
fahrenheit = (C * 9 / 5) + 32
celsius = (F - 32) * 5 / 9
cout << "The computed Fahrenheit value from temperature in Celsius: " << fahrenheit << endl;
cout << "The computed Celsius value from temperature in Fahrenheit: " << celcius << endl;
return 0;
getch();
}
【问题讨论】:
-
阅读一个好的 C++ programming book 然后阅读你的 C++ 编译器(例如 GCC ...)和调试器(例如 GDB...)的文档 请注意
#include <conio.h>是非标准的.见this C++ reference。启用所有警告和调试信息(例如,使用 GCC 编译器使用g++ -Wall -Wextra -g) -
很明显,您的导师所教的内容存在差距。这不是你的错。这也是功课。 SO 不是为您完成作业的地方。 “我的代码不起作用”并且只发布代码不是一个合适的问题。也不是一个可以通过简单地查找适当的代码示例来解决的问题。
标签: c++ integer cin cout temperature