Heat Index Function for Java Script

Look at the top of the function void calcheatIndex he is using a formula to convert temperature and humidity into the heat index. Then the answer is in Fahrenheit and he sees if the user wants it in celsius or not.

It’s the first formula here.
https://en.wikipedia.org/wiki/Heat_index#Formula

Using the formula you could have one function that takes input and outputs the heat index, instead of converting a chart into a bunch of switch cases.

Below I’ll try explaining some of the c++ specific parts of the function.


C++ is static typed, which means you have to tell the computer what type a variable is when declaring it, and with functions tell it what type it will return.

void FunctionName() means it will return nothing.
const means the variable cannot be changed after declaration, Note: JavaScript also has this.
double means the variable is a number.

cout<< is the same as console.log(),
and cin>> gets input through the console.