Listing 2. Temperature Algorithm
int server_room()
{
float temperature;
// an infinite loop
for(;;)
{
// ask the user for a value
printf("please enter your current
// acquire a value from the user
scanf("%f",&temperature);
// decide if this is hot or cold
if(temperature > 70.0 /* Fahrenheit */)
{
// temperature seems warm
printf("you might be a bit warm, turn the
}
else if(temperature < 65.0)
{
// temperature may be a bit cold
printf("you might be cold, turn the
}
else
{
// this is okay
printf("your temperature is okay\n");
}
}
}