# WSQ_05_On_To_Functions

--Originally published at Franco TC1017

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.

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

# Use of diferent Functions

--Originally published at how not to program

Here is a code showing diferent functions

#include <iostream>
using namespace std;

int num1, num2, res, dif, mul;
float div;
int resta(int a, int b)
{
dif = a – b;
return (dif);
}
int mult(int a, int b)
{
mul = a * b;
return (mul);
}
int residuo(int a, int b)
{
res = a % b;
return (res);
}
float division(int a, int b)
{
div = a / b;
return (div);
}

int main(){
cout << “Introduce dos numeros. ” << endl;
cin >> num1 >> num2;
cout << “La resta es: ” << resta(num1,num2) << endl;
cout << “La multiplicacion es: ” << mult(num1,num2) << endl;
cout << “El residuo es: ” << residuo(num1,num2) << endl;
cout << “La division es: ” << division(num1,num2) << endl;
return 0;
}

# Volume of a piramid

--Originally published at My awesome Blog!

Here is a code that help to give me an idea for our final project.
its about a volume of a piramid

#include <iostream>
// Este programa saca el volumen de una piramide con base rectangular, pide los datos al usuario (lado 1 lado 2 (area de la base) y la altura) y realiza las opereciones necesarias
using namespace std;

int main()
{
cout << “Escribe el lado 1 de la piramide en metros.” << endl;
cout << “Escribe lado 2 de la piramide en metros.” << endl;
cout << “Escribe la altura de la piramide en metros.” << endl;
cin >> altura;

volumen = areabase*altura/3;

cout << “El volumen de la piramide con lados que miden ” << lado1 << ” metros x ” << lado2 << ” metros y ” << altura << ” metros de altura, tiene un volumen de ” << volumen<< endl;
return 0;
}

# Homework 8: Yo soy 196

--Originally published at Let&#039;s CODE

We are going to calculate the quantity of Lychrel numbers (natural numbers that doesn’t convert on palindromes after a serie of aditions, for example, 196 is a Lychrel number), natural and made palindromes that are present in a range of integer numbers given by the user. If we want to convert a non-natural palindrome to … Continue reading Homework 8: Yo soy 196

# Homework 7: Lists

--Originally published at Let&#039;s CODE

This program will ask the user for 10 numbers and will be stored in a vector. Then, the user will be able to see the total of the sum, average and standard deviation of those numbers. A vector is very easy to use, you have to asign a type to the vector and give it … Continue reading Homework 7: Lists

# Homework 6: Factorial Calculator

--Originally published at Let&#039;s CODE

Let’s make a factorial calculator! First of all, we have to know what a factorial number is. If you see a number that is accompanied by an exclamation sign, you’re seing a factorial number, that consists in a number multiplied by all the precedent integer numbers until reach one. For example, 6!= 65432*1 = 720. … Continue reading Homework 6: Factorial Calculator

# Homework 5: Calculator

--Originally published at Let&#039;s CODE

This program will make some basic operations. It’s just like the program of the first homework, but using functions. We have to create 5 functions: sum, subtraction, multiplication, division and remainder. Each function must read two integer parameters (the same for each one) given for the user. Also, we have to declare another variable which … Continue reading Homework 5: Calculator