主页
C++
C++ If ... Else 示例
demo_if_temp
运行 ❯
×
更改方向
保存代码
更改主题
#include
using namespace std; int main() { int temperature = 30; // temperature in Celsius if (temperature < 0) { cout << "It's freezing!\n"; } else if (temperature < 20) { cout << "It's cool.\n"; } else { cout << "It's warm.\n"; } return 0; }
It's warm.