Temperature

Hi!

Welcome again. Now I made a code using temperature.

Instructions:

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9.

Modify the program to state whether or not water would boil at thetemperature given. Your output might look like the following.

And this is the Code:

temp

The main point is to convert Fahrenheit degrees to Celsius degrees. We all know that simple formula to convert the degrees: C = 5 ∗ (F − 32)/9.

Steps:

  1. Ask to the user to write the Celsius degrees (remember to save the variable with CIN).
  2. Use the formula in a way the computer can understand and the computer is going to convert the degrees.
  3. Show the Celsius Degrees.

Now I’m going to introduce IF and ELSE.

We use IF and ELSE to compare two or more sets of data and tests the results. If the results are true, the THEN instructions are taken; if not, the ELSE instructions are taken. (http://www.pcmag.com/encyclopedia/term/44748/if-then-else).

In this case IF temperature is more than 100° Celsius it will show up a message (“El agua hierve a esta temperatura”). BUUUUUT IF NOT it will show you another message (“El agua no hierve a esta temperatura”).

The basic structure is:

If (condition)

{ make this }

else

{ make this }

It isn’t really difficult. I have some knowledge of this because I took a course of an introduction to code.

Thanks for coming! See you later.

Code Link:

https://www.dropbox.com/s/5nynn2ucy8pluf3/Temperature.cpp?dl=0

CC BY-SA 4.0 Temperature by sercho93 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.