This program is similar to WSQ 01 but, instead of writing the direct operations, it calculates the sum, difference, product, quotient and residue through functions.

This link was really helpful to write this program.

I’d like to share my favorite quote from Bertrand Russell.

Mathematics, rightly viewed, possesses not only truth, but supreme beauty—a beauty cold and austere, like that of sculpture, without appeal to any part of our weaker nature, without the gorgeous trappings of painting or music, yet sublimely pure, and capable of a stern perfection such as only the greatest art can show.”
― Bertrand Russell, A History of Western Philosophy.


On to Functions code

Final Project – Arc Reactor

Hi, I´m Franco and this is my final project for TC1017. 

Cardiovascular diseases are the number one cause of death worldwide. File_000These problems affect a lot of kids as well. Cardiovascular diseases in kids mean that they cannot do activities that require a high level of exercise for a prolonged period of time, like running or playing outside. It would be easier for parents to take care of their kid´s health if they could oversee their kid´s heart rate easily.

My solution to this problem was to create a wearable light feedback monitor that constantly measures the patient’s pulse and emits a light at the same rhythm.

As it is intended for kids (cool kids), I made it in the form of Ironman´s arc reactor and big enough for parents to see it at a distance.

It is a completely original design. I designed the hardware, the electrical circuit, and the code.

If you would like to know more about this project, please come visit me at ExpoIngeniería.

File_001 (27)File_000 (37)ECG

Quiz Week 3 – Square/Cube Root

This program calculates the square root and cube root of a number given by the user. I included #include <math.h> so I could use sqrt() and cbrt(). Although it is recommended to use #include <cmath> instead. The code recognizes if the user inserts a negative number, therefore it tells the user that the square root is not calculable.

#include <iostream>
#include <math.h>

double square_root(double x){
double square_root = sqrt(x);
return square_root;

double cube_root(double x){
double cube_root = cbrt(x);
return cube_root;

int main() {

double x;

std::cout << “Insert a number” << ‘\n’;
std::cin >> x;

if (x < 0) {
std::cout << “Square root: ERROR: number cannot be negative.” << ‘\n’;
std::cout << “Cube root: “<< cube_root(x) << ‘\n’;
} else {
std::cout << “Square root: “<< square_root(x) << ‘\n’;
std::cout << “Cube root: ” << cube_root(x) << ‘\n’;

return 0;



WSQ 03 Pick a Number



Man up! Chose the red one!


This program selects a random number every time the user runs it. I had difficulties at first because the program selected the same number everytime. This link helped me solve this .

The program tells the user if his/her guess is too high or too low until he/she gets the right answer.


#include <iostream>
#include <stdlib.h> /*rand, srand*/
#include <stdio.h> /*NULL*/
#include <time.h> /*time*/

int main() {

int usernum;  /* This is the user input*/
int morfeosnum;  /* This variable will contain the random number*/

std::cout << “Hello Neo, I have a number between 1 and 100 in my head. Can you guess which is it?” << ‘\n’;

srand(time(NULL));  /* This makes a new random number everytime I run the code*/

morfeosnum = rand() % 100 + 1;  /* This sets my range of random numbers*/

do {
std::cin >> usernum;
if (usernum > morfeosnum) {
std::cout << “Your number is too high. Try again…” << ‘\n’;
} else if (usernum < morfeosnum) {
std::cout << “Your number is too low. Try again…” << ‘\n’;
} else {
std::cout << “You answered right, that is my number. Now… choose a pill…” << ‘\n’;
} while(morfeosnum != usernum);

return 0;


WSQ 02 Temperature

Fahrenheit to Celsius Converter. The user gives the Fahrenheit value, the program converts it to Celsius and if it is above 100 degrees Celsius, the program tells the user that water will boil at that temperature, otherwise it will tell the user that water will not boil at room temperature.

This program was easy as there is a formula to convert Fahrenheit to Celsius. I didn’t need any libraries so I only included #include


int main() {

float tempF;
float tempC;

std::cout << “Fahrenheit to Celsius Converter” << ‘\n’;

std::cout << “Enter temperature in Fahrenheit: ” << ‘\n’; std::cin >> tempF;

tempC = 5 * (tempF – 32) / 9;

std::cout << “A temperature of ” << tempF << ” degrees Fahrenheit is ” << tempC << ” degrees Celsius.” << ‘\n’; if (tempC > 100) {
std::cout << “Water would boil at this temperature.” << ‘\n’;
} else {
std::cout << “Water would not boil at this temperature. (25C and 1atm)” << ‘\n’;

return 0;