Project!

We had our last class today, great course(I´ll upload my course review later).

Time to show yall our Project(Saul, Alex and I).

3.9m ohm resistor.jpg
Click on it to get the code


Description: 

Our program is basically a resistance calculator, in which you type the color of your resistance and it´ll give you the value of it in Ohms and its tolerance. Giving you even the option to change the units to KiloOhms or MegaOhms.

Sin título.png
Quick view of the program

For showing the list of colors we made an external text file. (colores.txt)[click on it to get it] and don´t forget to put it in the same folder in Cygwin.

For the 4 bands, this will help you understand how resistances work.

color_code_table.jpg

So instead of using like 837373 conditionals, we reviewed our C# courses, in whice we used the cases, better known as “Swich”, so we made a swich for each band.

We write the operations to get the value of the resistance and the tolerance(just multiplications and divisions) and we add some conditionals to change the units in order to fullfit the user requirements.

Feedback

Working on this project was kinda easy, we used an external file to see the values of the numbers, we used loops, cases and we also added a new feature, COLOR.

To add color to your code here you have a link Ken shared with me, there are just like 8 colors but it still helps.

COLOR[link]

Easy to work with friends, to have more time for our other projects we made this one like 2-3 weeks ago.

Good luck again in finals.

Like always, a nice song:

 

 

#WSQ13 Exam2: T, T and T.

tumblr_md6pv4bkqk1rhnyg2o1_500.jpeg

[Click on Saul´s grandma´s image to listen a great song while you´re checking my post]

I know yall wondering how to do the first program of the exam soooo I got you the answer fellas, my code could be easier I think so I´ll be updating this post and adding it the other programs.

Well here´s the T code(click on an image, CHOOSE WISELY, one will go to GitHub and the other one to the DonaldTrump fan page, so be careful):

tttt.png          donald-trump-funny-look-alike-thumb.jpg

Dedico este post al MAGO Miguel.

#WSQ12 Word appearances

It took me way to much time to get this WSQ right, it´s still very confusing the changes between one language and another and even also between iOS, Linux and Windows.

First of all I definitely invite you all to check Orlando´s blog, thanks to his post I get my code right. Here´s Orlando´s blog. He´s the only one who made the counter way better by counting the word in a whole string line, not just reading one by line(I had my program working like this but I realized its not very functional to only read a word and skip the rest of the line. So Alex I think you should fix yours)

Important thing if you´re thinking in just copy Orlando´s code, it will only work if you have a Mac, why? Because windows need an important thing you can read here “Why I cannot just copy others codes :(? 

Here´s a small caption of how you must write the “c_str()” in your code:

line.png

Its essential to have your text file in the same folder as your program. I won´t say more here´my code will be bellow just click on RICK ASTLEY and you will end up on my GitHub.

12969426_10209238510464892_396541936_n.jpg

PROJECT

Newsss about the project, as you know I´m working with Saul and Alex on a resistance calculator in which the user types the colors of the lines of the resistance and we will return him the value of it, the tolerance and also the option to change the units between ohms, kiloohms and megaohms. We almost done everything, we´re working on a few details and when we get it we will post it on the IMT facebook page so you all can use it.:)

join-the-resistance.jpg07e6c70ab8d4eb6ab8c0f0b4dadee69aba2cd7a3.gif

 

 

 

 

 

 

Have a great weekend everybody!

#QUIZ06 Euclidian Algorithm

One week later is way better than never, instructions of the Quiz are here.

Summing the instructions we should create a code which receives two numbers or parameters from the user, then in a function print the biggest denominator that divides both numbers.

10330240_1045265532201362_6669094908167145769_n.jpg Clic on the amazed monkey for more information about the Euclidian Algorithm

                           [CODE on cygwin]

Once you understand the logic of the problem, its pretty easy to solve, you will only need a 4 lines function + the main part of the code.

jenfjejeAs you can see you only need to link two values to the function whose are the first and second value that the user typed.

Sin knceejdf.png

Here is the proccess using the two numbers of the Ken example´s page. 270 & 192.

Its was a good challenge, to improve our knowledge, I didn´t know what a Euclidian Algorithm was so it was interesting, and I think useful.

As Always, Random Stuff at the end[+Great song]

Yall love science(or Im just guessing) and for the same reason you´ll love this video

And a lovely song, of Alt J, Enjoy! And have a great holiday!

#QUIZ05 Palindrome & 3Divisibles

Sorry for posting Quiz05 until now but i totally had my mind in the Lychrel numbers(now on my blog if you want to check it) .

tumblr_o3nm7uOO7v1tiyj7vo1_500.jpg

Quiz05, first thing to do is something related to the Lychrel, check if a word(string) its a palindrome or if its now, creating a bool function for it and printing the result.

Some new stuff on the code, like using .size and .rend, not to hard to understand them but here´s more information. There´re different ways to get the inverse of a string, the one I´ve done in the code is the easier to do in my opinion. (If you find an easier one let me know)

Palindrome:[CODE]

palin.png

As you can see we´re working with a boolean expression ´cause we only need to verify if its a palindrome or its not. Instead of doing it as a bool try using int and give a 1 if ifs a palindrome or 0 if its not, both methods work perfectly.  Quick doubt-solving page for you who don´t know what´s r.begin and .rend.

And here the main part of the code:

main.png

Just make a condition for the boolean expression and thats all.

3Divisibles:[CODE]

In this case, you have to create an array which contains a whole bunch of numbers that the user types and add only the ones which are divisibles by 3. Example: Range(5,3,10,6,2) from this range it only add the 3 and the 6. So it prints the total of the addition as a 9.

In my case, before giving the array a value, I ask the user for the numbers of values he will type, and thats the capacity of the array.

3div.png

And just like the #WSQ10 you create a for loop to ask for all the values.

total

Easy to understand, I

Sin título.png

Continue reading “#QUIZ05 Palindrome & 3Divisibles”

#WSQ11 #NadieQuiereSer196

One freaking week breaking my head and having brainstorm ideas to figure out how to write this satanic code(Not even Satan would create something like this) thank God Aguayo for gave me the patience to not freak out and finally finish the code.

As usual here´s the code(yeah i know you´re just coming to my blog for it) click on the random image to go to GitHub[The code won´t work until you install the BigInteger and do all the proccess Ken explains in this VIDEO] and don´t forget to thank Aguayo for his greatness

12800132_10208894747391030_7422022885247348938_n.jpg

I´ve also made a video explaining the code working and its structure so there isn´t any screenshot this time, here it is:

Like always, here some random Tumblr picture again

 

 

#QUIZ04 Euler didn´t have a girlfriend right?

Finallyyyy Euler, we know u r dead but meeeen why u did this to us? tought we were friends buddy.

Euler didn´t have a real hobbie like playing soccer, go to some ancient clubs and drink absenta with his friends(in case he had any) he used to be in his room, wondering how he could make our existence a little bit harder, you had one job Euler.

My first reaction when i saw the quiz was like: Damnnn Euler you ain´t my brotha anymore, you playin´

200_s.gif

 

Well click on the image above to get my code on GitHub.

This time i won´t make a video ´cause I´m preparing myself for the #YoSoy196 WSQ, winter´s coming so I´ll need to be ready.

Ken helped us in class, my trouble was that i didn´t know how to dictate the parameters for the factorial to indicate it when it must stop.

The Euler formula is pretty easy(but he didn´t use it lol):

f1

EXTRA STUFF

We were considering (AlexFoo, SaulTorres and I) to do a minigame for the project but we think it´s better to start doing some mecathronics stuff like using sensors and everything, we´ll see.

Check out this song, deep lyrics deep meaning

See yall, try to not die.

 

 

 

 

#WSQ10(Video)What the heck

Now this is more confusing, we must combine loops, functions, mathematical formulas, a few of all the topics we´ve seen until now.

tumblr_nn0zrg89NJ1sszkwto1_540.png

This code will be completely different to the ones you´ve done before(talking abt myself) well, here´s the code posted on GitHub.

To beggin, add the usual library <iostream> and instead of using the “using namespace std” just determinate which of the parameters of the library you´ll use. Also add the <cmath> library because you must use it for the StandartDeviation part of the code.

The program must ask the user for 10 float values, counting and saving them using a variable in function of another, numbers[i]. Repeting the “for” loop as many times as you give the instructions to the program in the NUMOFNUM variable.

Now what? Well the code must have 3 functions(3 + the main) one, which will calculate the total addition of the numbers the users gave. Secondly, the average of the 10 numbers the user typed and finally, the standart deviation(I´ll explain a lot better in the video bellow what is it and how to get it).

Create the function for the total and in it, the program must do a loop to be adding the next value and to not write everything like(number[1]+number[2]+number[3]…etc.

total

In the next one, the average, you don´t have to add the numbers again, just call the last function and just divide it for the number of values(in this case 10) and there you go, you got the average. As you can see in this part of the code you don´t need to create a new loop, using the result of the addition function is all.

averag.png

Now the third part, the standart deviation(yeah i know, you don´t even know what the heck that means haha me either so i had

28eab7e10b01875cf06fa63ca434e055
stdev_s

Continue reading “#WSQ10(Video)What the heck”

#Quiz03(finally!) VIDEO

This was the most difficult program i´ve done since i started coding. The first one was extremely easy but the fibonacci´s got me like

24

Well lets check the codes here´re both of my codes

1st Program: Create a code that calculates the distance between two point in the cartesian plane.

Easy one, the user must type the coordenates of the two points(giving the x and y values of both of them) and using the pythagorean theorem getting the addition of the squares of the differences between x1-x2 and y1-y2. Well here´s a ss of the code and how it works

dist

Dont forget to add the cmath library to use the square root.

2nd Program Fibonacci´s(wth)

Now we´re talking about serious stuff, doing this code was extremely difficult i was breaking my head because i was trying doing it with loops(and there must be a freaking way and later ill figure it out!) then i found the formula

image62

Anddd this helped a lot, to understand better the formula and the proccess. Friday in class me and AlexFoo found a website that explain the fibonacci(and the code) incredibly well. Here´s the page m8s

Let´s check a quick video made by me, explaining the code and some of the fibonaccis uses.

Hope that the video may helped you a little bit, if you have a doubt don´t hesitate to contact me in Fb (Darío Magaña) Twitter @dariosneijder or in my cellphone 3521252322.

I want to take advantage of this post letting you here my Tumblr account, i´m always posting interesting stuff about everything and some amazing pics and thoughts just like this one: