Making Decisions with AI
Explore how to use if else and nested conditions in C++ to create responsive programs that make decisions based on input. Understand input validation and learn to use AI as a coding partner to generate, test, and refine logic. This lesson guides you in building practical projects such as an automated thermostat and a smart washing machine advisor that adapt to user preferences.
The project
You’ve just moved into a great neighborhood, but your new home needs an upgrade to its automated temperature control system.
Currently, the thermostat is fairly basic; it can’t determine whether to turn on the air conditioning or the heater. A static display that says Temperature is 25 isn’t very useful. What you really need is a system that can make decisions based on the temperature and your individual comfort level.
With your confidence in your C++ skills now, you aim to create this thermostat logic yourself! This smart home system should compare the current room temperature with the user’s preferred comfort temperature and then determine the appropriate action.
The programming concept
Imagine this:
You’re writing a program, and you want it to say:
You can vote! If the person is 18 or older.
Sorry, too young. If ...