天氣小卡片只寫一個詞:低於 10 度是 "cold",25 度和以上是 "hot",中間的是 "mild"。寫 weather_word(temp) 返回這個詞。
weather_word(5)→'cold'weather_word(18)→'mild'weather_word(30)→'hot'const char *weather_word(int temp)const char *weather_word(int temp) {
// 在這裡寫:低於 10 返回 "cold",25 和以上返回 "hot"
return "mild";
}
寫好了先點「執行」試試示例,沒問題再點「提交」。