What was the temperature again?

Temperature

Might be a little too cold for me down there…

We are going to see how well we’ve understood the “if” and “else” conditionals, you know, those pesky words from fifth grade Grammar:

WSQ4

First up we have the code. Notice that there is a void type function before the main function. This was used by me in order to see if I knew how to correctly use those, and it turned out well, but the code can do without a void type function, having the “if” and “else” conditionals inside the main funciton.

WSQ4 cyg

As usual, we compile in Cygwin to check for any mistakes and happily find out there are none, giving the program the value 289 as Fahrenheit temperature.

WSQ4 cygrun1

It does work! We get the conversion from Fahrenheit to Celsius and a message indicating that water reaches its boiling point at this temperature. Then we try with a lower value and get a message informing us that this is too low for water to become a gas.

Water

Water wonderful picture! “I <3 Water” by Derek Gavey. Link: https://www.flickr.com/photos/derekgavey/5599832932/

CC BY 4.0 WSQ05 by Alan S. Olalla is licensed under a Creative Commons Attribution 4.0 International License.