Home Segments Index Top Previous Next

296: Mainline

The following expression, for example, evaluates to 1 only if the value of the temperature variable is between 25 and 50:

25 < temperature && temperature < 50 

Accordingly, the output statement embedded in the following if statement is evaluated only if the value of the temperature variable is inside the 25-to-50 range.

if (25 < temperature && temperature < 50) 
   cout << "The temperature is normal." << endl;