Quiz 3

Hey there, here is my quiz 3 results and solution, the instructions where the following ones:

  1. Write a function called distance(x1, y1, x2, y2) which receives four numbers which represent two points in the cartesian plane. The function should return the distance between the two points (x1,y1) and (x2,y2).
  2. Write a function called fibonacci which receives a single parameter “n” (a non-negative integer) and returns the nth number in the fibonacci series.

Here I leave you a link to the quiz: QUIZ3

For the first one, here I leave you all the pictures:

Click to view slideshow.

You can get access to the code in the following link:

https://gist.github.com/batmantec/03e91eda0605eef62746

For the second one, it actually took more research, because I didn’t understand what is the sequence that the Fibonacci use, for it I consult a lot of websites, which I will list here.

http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fib.html

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

http://platonicrealms.com/encyclopedia/Fibonacci-sequence

At the end, It was really weird how I did manage to make it, but It did gave me the results I was hoping for.

Here I leave you some pictures of the code and the program running:

Click to view slideshow.

The link to the code is here:

https://gist.github.com/batmantec/3ab093f33ee801a6fbdf

Website to master all the topic of C++

The best website to know about C++, at least for my point of view is http://www.cplusplus.com/ here you can search for almost any topic that has to do with C++. You can find from the most essential parts, like how to create a hello world to advance topics on it.

Sometimes reading theory can be annoying, but this website has some examples of code that works, so you can try to implement it onto your program. They are many ways to learn, but for me is seeing how a code is structured and try to understand the logic of the person. This way, I can force my self into knowing different type of logic and the combining those by taking the best part of their logic and structure.

So I use other sources for it, such as youtube, more blogs, and more websites. But this one is the first that I consult for information, because is the most basic way of the code, and it shows you all the parts of the function and ways to implement it.

 

·Fun with numbers· #WSQ03

Well, another homework… haha just kidding. I’m learning how to improve my codes and all that stuff. I started reading some articles and looking for examples in c++, as I said previously, I didn’t remember how to write in c++. I spent a time exploring this helpful page. There a lot of tutorials in c++ and references.

Captura de pantalla 2016-01-22 a las 12.03.43

After reading for a while some tutorials and articles, I decided to start writing my code. My objective was to create a program that given two numbers, it could calculate different operations. I looked in some of my classmate’s programs in order to remember how to write all de cout and cin stuff.

And here is the result, after a few mistakes and trying to figure it out what was wrong, my program was finally running!

Captura de pantalla 2016-01-22 a las 12.16.38

And here is my program working in Terminal…

Captura de pantalla 2016-01-22 a las 12.18.30

Also, you can see my code on GitHub here

Captura de pantalla 2016-01-22 a las 12.20.30

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/