Homework 12: Estimating e

--Originally published at Let's CODE

This program will be capable of estimate the value of “Euler’s number” (e) and the user will give the accuracy expressed as a number of decimals. To calculate e, I declared three variables. One of them saves tha value of e, another counts each executation of the loop, and the last one (x), in each ocassion … Continue reading Homework 12: Estimating e

Homework 11: Go Bananas

--Originally published at Let's CODE

Now we are going to make a program that can find the quantity of BANANAS present in a text file. The word “banana” can be writen in any way, that’s why I opted for converting all letter in the document to lower case. I set a vector called BANANA with a size of 6, where … Continue reading Homework 11: Go Bananas

Homework 10: Babylonian Method

--Originally published at Let's CODE

This function will calculate a square root through the Babylonian Method. First of all, I would like to explain how the method works. You have to establish a first number that is “aproximate” to the real squareroot, doesn’t matter if that number is equal to one, because we are going to make some mathematical operations. … Continue reading Homework 10: Babylonian Method

Quiz week 11: Partial #2 Review

--Originally published at Let's CODE

The teacher gave us a document with 10 problems to solve. This with the objective of practicing the topics that we have seen during the semester.   Exercise 1: Write a function that calculates the distance between two points in a coordinate plane. I used the Pythagoras theorem. #include <iostream> #include <math.h> using namespace std; … Continue reading Quiz week 11: Partial #2 Review

Quiz Week 9: The distance between coordinates

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

The task for today was only creating a function that could calculate the distance between two pair of coordinates on the cartesian coordinates plane that were given for the user. In the quiz was not necessary to create the entire program, but the function cause it was the only part required. To make this part … Continue reading Quiz Week 9: The distance between coordinates

Quiz Week 8

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

This class we were oredered to write a code that generates the Fibonacci series. I was a really challenging task, ’cause my logic didn’t adapted to the situation righly. Finally I used some loops, vectors and a function to make it work. This is what I wrote. #include <iostream> using namespace std; int fibonacci(int n) … Continue reading Quiz Week 8

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