Conditional Statements in C++
For this activity, you will need to be using an Integrated Development Environment (IDE). The recommended IDE for this module is JetBrains IntelliJ IDEA for Python and JetBrains CLion for C++. You can follow instructions at the following page to set up your development environment:
Setting up your Development Environment
Task 1 - Calculating the Factorial of a Number
For this task, you need to write a script that will calculate the factorial of a number (the number must be a non-negative). The function will accept the number as an argument and return the factorial.
If you are struggling with this task, you may want to read up on factorial numbers.
Hint
For this task you will need to use a conditional statement to aid in the solution for this function.
Task 2 - Converting Temperature Units
For this task, you need to write a function to convert temperatures to and from Celsius and Fahrenheit. You will want to consider that the input will be either 45F or 12C etc. The function will be called temperature_conversion.
Hint
For this task you will want to consider the following equation:
\(C = (5 / 9) \cdot (F - 32)\)
You may also assume that the temperature being using in this equation is an integer.
Struggling?
If you are struggling with this lab activity, you may want to get some additional support. You can speak to the module leader/team in the room of when the lab week is active, or you can visit the Additional Support page for more information on how you can get extra support.