#include <stdio.h>
// This function simulates a simple decision tree
void should_i_go_to_the_beach(int temperature, int is_sunny) {
printf("Temperature is %d°F and is_sunny is %d\n\n", temperature
, is_sunny
);
if (temperature > 70) {
if (is_sunny == 1) {
printf("✅ Heck yeah! Go to the beach!\n"); } else {
printf("🤔 It's warm, but not sunny. Maybe a walk instead?\n"); }
} else {
printf("❌ Nah, it's too cold for the beach.\n"); }
}
int main() {
// What if it's 80°F and sunny?
should_i_go_to_the_beach(80, 1);
// What if it's 60°F and sunny?
should_i_go_to_the_beach(60, 1);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgovLyBUaGlzIGZ1bmN0aW9uIHNpbXVsYXRlcyBhIHNpbXBsZSBkZWNpc2lvbiB0cmVlCnZvaWQgc2hvdWxkX2lfZ29fdG9fdGhlX2JlYWNoKGludCB0ZW1wZXJhdHVyZSwgaW50IGlzX3N1bm55KSB7CiAgICBwcmludGYoIlRlbXBlcmF0dXJlIGlzICVkwrBGIGFuZCBpc19zdW5ueSBpcyAlZFxuXG4iLCB0ZW1wZXJhdHVyZSwgaXNfc3VubnkpOwoKICAgIGlmICh0ZW1wZXJhdHVyZSA+IDcwKSB7CiAgICAgICAgaWYgKGlzX3N1bm55ID09IDEpIHsKICAgICAgICAgICAgcHJpbnRmKCLinIUgSGVjayB5ZWFoISBHbyB0byB0aGUgYmVhY2ghXG4iKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwcmludGYoIvCfpJQgSXQncyB3YXJtLCBidXQgbm90IHN1bm55LiBNYXliZSBhIHdhbGsgaW5zdGVhZD9cbiIpOwogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgcHJpbnRmKCLinYwgTmFoLCBpdCdzIHRvbyBjb2xkIGZvciB0aGUgYmVhY2guXG4iKTsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICAvLyBXaGF0IGlmIGl0J3MgODDCsEYgYW5kIHN1bm55PwogICAgc2hvdWxkX2lfZ29fdG9fdGhlX2JlYWNoKDgwLCAxKTsKCiAgICAvLyBXaGF0IGlmIGl0J3MgNjDCsEYgYW5kIHN1bm55PwogICAgc2hvdWxkX2lfZ29fdG9fdGhlX2JlYWNoKDYwLCAxKTsKCiAgICByZXR1cm4gMDsKfQoK