#include <iostream>
using namespace std;
void describeWeather(int temperature) {
if (temperature >= 30) {
cout << "날씨: 매우 더움 🔥" << endl;
} else if (temperature >= 20) {
cout << "날씨: 따뜻함 ☀️" << endl;
} else if (temperature >= 10) {
cout << "날씨: 선선함 🍃" << endl;
} else if (temperature >= 0) {
cout << "날씨: 추움 🥶" << endl;
} else {
cout << "날씨: 매우 추움 ❄️" << endl;
}
}
int main() {
int temp;
cout << "현재 온도를 입력하세요 (섭씨): ";
cin >> temp;
describeWeather(temp); // 사용자 정의 함수 호출
return 0;
}
#include <iostream>
using namespace std;
void checkDustLevel(int pm10) {
cout << "미세먼지 농도: " << pm10 << "㎍/m³" << endl;
if (pm10 <= 30) {
cout << "상태: 좋음 😊" << endl;
} else if (pm10 <= 80) {
cout << "상태: 보통 😐" << endl;
} else if (pm10 <= 150) {
cout << "상태: 나쁨 😷" << endl;
} else {
cout << "상태: 매우 나쁨 🚫" << endl;
}
}
int main() {
int dust;
cout << "오늘의 미세먼지(PM10) 농도를 입력하세요 (㎍/m³): ";
cin >> dust;
checkDustLevel(dust); // 사용자 정의 함수 호출