Here are my github links:
https://github.com/OctavioIRG/TC1017/blob/master/Quiz-cheese/quizz11-1.cpp
https://github.com/OctavioIRG/TC1017/blob/master/Quiz-cheese/quizz11.cpp
]]>
Believe me Windows Users, there is a better world outside and it’s called Linux.
]]>So let’s start:
]]>This is a very cool tool to use with c++. The first time I used this I was shocked. How can this order work?! I mean, suddenly this type of assgiments have created in me some sort of extreme curiosity about what’s behind a computer. How does this computer I’m writting on works? It’s amazing. How ever, the point here is the mastery so let’s continue.
To read a file, and write on a file or do anything to a file you need to include a library called fstream. You know use the familiar “<>” symbols and the #include at the begining of your code.
]]>A matrix is a simple array, but in this case the arrays has two dimensions. We had to use this concept to undestand how to perform the imagemagick challenge.
For those of you that know spanish(haha just kidding…) there is a cool blog that explains this:
https://ronnyml.wordpress.com/2009/07/04/vectores-matrices-y-punteros-en-c/
]]>An array is very cool way to store information and a cimple way.
An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
That means that, for example, five values of type int
can be declared as an array without having to declare 5 different variables (each with its own identifier). Instead, using an array, the five int
values are stored in contiguous memory locations, and all five can be accessed using the same identifier, with the proper index.
In simple words, an array is information stored in such a way that you can access each part of your information using a name and an index number.
]]>
Recursion and stuff…
Welcome to my brand new post. This time I want to show how to use recursion in a very simple function. We already did this in an iterative way and I thought it would be nice to show how to do it in the recursive way. I’m talking about the fibonacci numbers.
Here is a short video explaining an example of the recursive funcition to calculate the fibonacci number of a given index.
Check also this resources to know when to use recursive functions.
http://www.cplusplus.com/articles/D2N36Up4/
In this article the dicussion is set around when to use a recursive function. The answer can’t be easier: when a function calls itself.
Personally, I like cplusplus.com I’ve found useful articles and discussions about many topics. Believe me there’s a post for your questions there.
Here’s another piece of information from cplusplus.com:
http://www.cplusplus.com/forum/articles/2231/
]]>
This post is about mastery number 18. The use of nested conditionals. I explained a simple example in the next video but I would also like to share other resources such as tutorialspoint.com’s exlanation of nested conditionals.
Take a look to it.
http://www.tutorialspoint.com/cplusplus/cpp_nested_if.htm
Another video I watched is about if/else interaction and nesting those loops.
I think the most important conditional that allows nesting is the if. You can read a nested bunch of if’s as: If this is true, the perform this if this is true, perform the next if this is true and so on… You could use opertaros such as && and || (and or) to simplify some nested conditionals and make your code easier.
]]>Well I got helped and I read Carlo’s solution. The thing is that my answer should work but i had a little problem with the way my number are added.
]]>
This is a cool WSQ, in fact this was one of my favorites. Why? Because at first it was hard, nevertheless I did it! Honestly, it took me around two hours to finish this WSQ.
Any way, here is my code:
https://github.com/OctavioIRG/TC1017/commit/a2fc843ad2b3ba057b40c4b2f2becaebdf9f12f5
I thought it would be cool to show the user how the babilonian method starts aproximates to the actual value of the square root, thus I decided to print each cycle. The cycle breaks when the last and current value of the squareroot is the same.
]]>