#WSQ10

--Originally published at May The Code be With You

Today, we are going to calculate a square root using an unconventional method, the Babylonian Method.

You may ask “What the heck is a Babylonian?!”. Well, Babylonials were an ancient culture who gave a lot to our math knowloge, by creating methods like this to calculate certain things.

This particuliar method consist in cutting a rectangle until it gives you the closest number to a square. Of course we are not cutting anything, we will just follow the formula.

So, the formula basically says “Take the number you want to know its square root, add the closest perfect square number to it. And divide all that by the square root of the perfect square number multiplied by two”

I know it may sound a little complicated, but here is a video to explain it in a simplier way: https://www.youtube.com/watch?v=sFMK3v879kg

As a human, you have a natural sense of comparission between number, so in that way you can know which perfect square number to use, but in your program you will have to make a for loop and increase the number and multiply it by itself in order to get the closest one, simple.

Quiz_8

--Originally published at May The Code be With You

This time I´ll teach you how to get through quiz#8.

The main topic of this quiz is the Fibonacci Series. A special serie where the two previous numbers summatory gives you the next number. You can see it here:

http://www.disfrutalasmatematicas.com/numeros/fibonacci-sucesion.html

Knowing this is quite simple how to do it.

As you can see, since the series starts with 0, if the user ask you for the first term, you will have to return 0, and also for the second and third term you will have to use ifs in order to return “1”.

And for any other term just use the formula.

Simple

#Quiz_Week9

--Originally published at May The Code be With You

This time I’ll show you how to do the Quiz#9. Wich consist on getting the lenght of a Vector, Basically.

So, if you have basic knowloge on physics you may know how to get it. It is very simple due to the fact that the user gives you the coordenates of the two points in the cartesian plane. So, this is my code:

As I said, easy peasy lemon squeezy.

#WSQ09

--Originally published at May The Code be With You

This time I bring you the third most difficult WSQ (in my opinion).

The WSQ09 ask us to open a text file, count how many lines doest it has, and how many characters.

When I first saw it I say “Whaaaat?! How am I supposed to do so?”. But with the help of Ken and my friend Adal, I found the way.

Well, first of all, is very important that you do some research by your own in google, about how to open files and about structures (are very handy in this assignament). Remember, as Ken said: “Stack Overflow and cplusplus.com are your friends”.

A structure is a format that let you storage several variables, even of different types, inside one concept.

And, you will also need the library <fstream>

As you can see in my code, I made a struct named “info” in wich, I saved 2 variables of “int” kind.  After you research, you may see that there are some commands that let you do the exat thing you wanted to do, just like open the file, conunt the lines, and so and so. I hope yu get the syntaxis of this code.

#WSQ07

--Originally published at May The Code be With You

I know it´s been a lot since I wrote a blog. But, here am I. Then, let´s begin.

This time I bring you the WSQ07, wich involves the use of Arrays. An Array is a set of characters (numbers in this case) wich give every character a number and an order. In order to use them we use: “[]”.

This WSQ ask us to take a list (array) data, sum its numbers, the average of them, and the standard Deviation.

The Standard Deviation is basically, the average of difference between each number and the actual average. You can read this information here:

https://en.wikipedia.org/wiki/Standard_deviation

First, I will put the photo of my code, then I will explain it.

As you can see, it´s all about “fors”. So, you first make a loop with a variable “i”, wich starts in 0 and add one to it until is lower than 10. You just have to add a variable to sum all the terms for every loop.

Then, to get the average, just divide the summatory of that variable by 10. And for the satandard deviation just follow the formula.

After you think about it, you realize it is quite simple.

#Final_Porject

--Originally published at May The Code be With You

This time I´d like to introduce you to my Final Project for the “Solving Problems with programming” class… “The Emulator of Mini-Consoles with Pi”.

Months ago, my friend, Roberto Estrella Mariscal, and I saw a video on YouTube, about a guy who recreated a Mini-NES Console, using a Raspberry Pi Mini Computer and I said “It would be great if we had one of those and we could recreate that”. Then my friend said “I have a Raspberry Pi”, Immediatly I said “Let´s do it then!”, and so we did.

We did a lot of research about how to do it, because we were on 0% on Raspberry Pi knowledge, we didn´t even knew how does it work. But after some research we finally found some video-tutorials and forums that helped us to develope this project.

Here are the results:

As you can see, It has several emulators, for some Consoles,including NES, SNES and GBA.

And the last Image is about us playing the original DOOM.

For this project we used a:

• Raspberry Pi 1
• A HDMI cable
• A clean USB Drive
• A SD clean card
• A PlayStation 3 controller

First, after some research, we prepared the Raspberry  to read the hard drives, then we download several files, emulators, software, etc. We Instaled them in their respective HD and finally we did the configurations.

One of the main problems we had with this project was Raspberry´s version. Since this is a Raspberry PI 1, It has a lot less things than the newest one, the Raspberry Pi 3. Things like Wi-fi connection, bluetooth, etc. This means we had to deal with some issues. Like, first we installed a emulation programm named “Retro Pie” but, since it uses Internet connection to download the emulators, we hat to

#International Experience

--Originally published at May The Code be With You

I wanted to tell you about an activity I did last week.

Last Friday, I participated in an activity named I@tHome. This activity was developed between McEwan University in Canada and Tec de Monterrey Campus Guadalajara, in which, students have videoconferences between the two countries and discuss about new Technological App that can help Humans to get its life easier.

I learned a lot about Canadian Culture and points of view about how people is willing to help each other through Apps, I would pleasantly participate in an activity like this again

#WSQ06

--Originally published at May The Code be With You

This particular WSQ is a little bit more complicated than the ones that we have been doing, but it can be easily done with a simple function. Just make a factorial number.

If you don´t know what a Factorial Number is, you can look for it here: https://www.mathsisfun.com/numbers/factorial.html

But in simple words, a factorial number is a number in which its previous numbers are multiplied by the previous one. For examble 3! (Yeah, because “!” means factorial) is equal to: 3x2x1=6 so 3!=6. Do you get it?

So, basically you have to ask the user for a number and once you get it, you substract one to that number and multiply it, then substract one to that number and multiply it, and so and so until it reaches 1. Basically this:

Essentialy, the function does a loop, in which it does what I already said.

The “system (“clear”)” thing, is something I add ir order to clean my compliling screen after it goes through the loop. So in that way it looks better. Like this:

so when I press “y”:

It automatically clears and looks nice.

But, in order to use that, you must also use the library <stdlib.h>

That´s all from me, See ya around!

#WSQ05

--Originally published at May The Code be With You

This time, we are going to do a very simple WSQ, is just the number 1, but instead of doing all the aritmetic operations in the main function, you just do a different for every one.

Yes, by this point of the semester you must already know what a function is, and is you don´t, you are in serious problems. And probably you must start reading the book. So, Let´s start from the beginning.

And finally, here is my code:

And this is what it prints:

That´s all Floks, See ya around!

#Quiz_6

--Originally published at May The Code be With You

Finally, in this post, Ipm goint to tell you how i did quiz Week 6.

In this quiz, you are supposed to write 5 programs from this webpage: http://www.utdallas.edu/~ivor/cs1315/clabs96.html

Excercise 1

The first one is something like this:

At the beginning it may look a little bit strange to you, because of certain character but first you should read this: printf reference here.

After you read it, you may realize that is easier to write it with some elements of C language, just like “printf” and “%d”.

But after you read you realize is pretty simple, just like this:

If you cursed Intro a la computación, you might know what to do with the %d.

So, when you run this program it gives you something like this:

Excersice 2:

So it consist basically in converting a char to an in and a float and visceversa. A thing C++ does by itself.

So you may have a code like this:

So the printing will look like this:

You may notice, that I used a C style, only because I wanted to do it different and it is also more practical for me.

Excersice 3:

You may think, “How the heck am I going to print this?”, well, yuo just need to literally write it just as it looks, in the main function.

Told ya.

Excersice 4:

Yes, that´s right, as simple as that. so I dont need to tell you that you just need to use some nested conditional and that is all:

Excersice 5:

Finally, In excercise 5, you just need to do this:

So if you could do the previous excersice, it shouldn´t be a problem, and you will get something like this:

So, that would be all, hope it get useful