Final Exam Practice

Hey guys!  I solved all the problems Ken uploaded as practice problems TC101_FinalExamQuestions (1) . The only one I did not do was number 9!! IF YOU HAVE THE SOLUTION FO THAT ONE PLEASE SHARE IT TO ME. Have fun.

HELLO EUCLID:

euclides_2

HERE IS THE CODE FOR EACH PROBLEM ON GITHUB:

Problem 1

Problem 2

Problem 3

Problem 4

Problem 6

Problem 7

PROBLEM 9: STILL MISSING! SHARE YOUR KNOWLEDGE WITH ME.

Problem 8 : TAKE A LOOK A THIS VIDEO TO UNDERSTAND: https://www.youtube.com/watch?v=sZmz7znP6x0

Problem 10 : THANKS TO THIS BLOG FOR HELPING ME OUT: http://fahad-cprogramming.blogspot.mx/2013/11/find-greatest-common-divisor-gcd-of-two.html

11 de Mayo, 2016

WSQ14-SciLab

SciLab is an incredibly useful software used to perform complex mathematical calculations, plots, etc. It works using  matrices. As explained in their introductory document:

“Scilab is not a computer algebra system. It calculates only with numbers. All calculations are done with matrices, although this may go unnoticed. Even if the concept of matrices is unknown, vectors and sequences of numbers can explain it, as they are, in fact, matrices of dimension 1 × n or n × 1 and a number is itself a matrix of dimension 1 × 1”

scilab.png

Take a look at a quick introductory video, made by myself (IN SPANISH):

WSQ13 Exam review

On this post I’ll show the correct code for the problems of the second partial exam.

During the exam, I was able to solve just a few of the problems asked, however, on this post are the problems solved.

It was good to make this activity, in order to learn from our mistakes.

Click on each of the links to see the solution on GitHub:

 

Problem 1

Problem 2

Problem 3

Problem 4

Greetings!!

 

PROJECT: DATE FINDER 1.0

Keep-Calm_Final-Project

The day to upload the final project arrived. And here it is, here I am! Surviving my finals.

So, what this program basically does is it tells you what day of the week was, is or will be from whatever date you input to the program. It also tells you if the year of your date was a leap year or not, and gives you the option to display leap years from your date to 100 years later.

It gives you the option to create a text document, named as you like or named as the day of the week of your date (.txt). It gives you the optionto write information inside of the document.

Another interesting thing that it does is that it can tell you  a cool fact about a leap year from 1900 to 2016, whichever one you choose.

To understand how it works better, run it on your computer or watch the demo run video (IN SPANISH) of the program here.

For this program I integrated my C++ knowledge learned on this course to be able to make it. In order for the program to work, I used:

  • If else statements.
  • While and do while statements.
  • Basic input and output (CIN, COUT)
  • For loops.
  • Arrays. Exampel of use: int leap_ar [] = {1904, 1908, 1912, 1916, 1920, 1924, 1928, 1932, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016};
  • File handling and creation.
  • Writing on files.
  • Strings.
  • Basic algebra and operations.
  • etc…

Among other useful tools learned during this course.

Credit for the equation used in this program to calculate the day of the week goes to: http://www.tondering.dk/claus/cal/chrweek.php#calcdow”
Credit for the info on leap years goes to http://www.infoplease.

Archivo_000
Archivo_001

Continue reading “PROJECT: DATE FINDER 1.0”

#TC101 Course Review

I really enjoyed having this class. I think it helped me a lot to learn about programming logic in general, structure, syntax etc. I also learned a lot about the specific programming language C++, which will be really useful during my Mechatronics studies in the future. About transversal topics, I learned the usefulness of a hashtag in general, be it on Twitter or be it on Ken´s blog. I learned to blog, I learned to install and use Cygwin, to video record my screen with Screenscatify , the importance of Flowchartsand many other things that I may not recall at the moment.

I made two videos talking about my experience on this course. Pardon my accent  🙂

Yo soy 196. Palindromes and Lychrel numbers

ANITA LAVA LA TINA

RECONOCER

RACE CAR

Here you can take a look at My code on GitHub.

You should really check out Orlando´s Blog post.  You´ll learn how to do it perfectly.

 

First of all, I really have to thank Orlando Lara. Thank you for your time doing those amazing videos teaching us mortals about #WSQ11. Also many thanks to my teacher Ken Bauer, for his video explaining how to use BigInteger s on the program. You should really check out Ken´s video, cause it is kind of complex how to use and compile programs with this BigIntegers.

Basically those were all my sources to make this program. I once again thank Orlando, for teaching us how to use strings and bool functions. Before this program, I had never used them.

Following Orlando´s guide (sorry for saying it so much, but is the truth), I made my program to work with only two functions. One flips out each number of the sequence, using this:

BigInteger Num_reverse (BigInteger i){

string neto = bigIntegerToString(i);
neto = string(neto.rbegin(),neto.rend());
i = stringToBigInteger(neto);

return i;
}

It is a command to flip out the string, but what the function does first is convert once again the number from BigInteger to string (which we had already done the inverse process). Then it reverses the string and converts it back to a BigInteger using “stringToBigInteger()”. 

So this function is called inside the main, on a for loop that runs from the lower bound of the sequence provided by the user to the highest. SO IT FLIPS EACH AND EVERY NUMBER OF THE SEQUENCE. After this, with an if, it checks out if the flipped number is equal to the original number. If this  is true, the we just found

Continue reading “Yo soy 196. Palindromes and Lychrel numbers”

Quiz 6. Euclid.

Euclid was one of the great ancient greek guys. Among the stuff he invented was the algorithm bearing his own name.

This is a common algorithm used in computing. It is used to find the greatest common denominator of two numbers (GCD). If you want to learn more about this, you should totally check the explanation at Khan academy´s post.

Orlando´s code helped me a lot. You should totally take a look. First I tried to make the code using a do while loop. It was becoming really hard, until I saw Orlando´s code using recursion. It was way easier to code it this way .

Here you can see a picture of the code (anyways you can see it on github Here):

code_euclid

code_euclid

Link to my code on github.

Quiz 5

 

Finally, I switched from CodeBlocks to Cygwin and Notepad++.

For this quiz, we were required to make two programs. One had to verify if a word was a palindrome or not, and the other had to make the summatory  of all the numbers evenly divisible by three, from a list of numbers provided by the user.

The second problem was way easier for me than the first one, since I had never used strings in my life. After doing some research on strings, I tried my first version, which did not work. Today, Salvador Ibarra´s blog was updated with a really helpful video on the subject, in Spanish. Also, his code on github helped me a lot. So basically, thank you Salvador, I owe you one.

But the thing is not only to copy, but to understand, so here I´ll explain you my version of the palindrome program.

First of all, a palindrome is a word or a number that can be read normally or backwards and yoy get the same word. For example Anna, read it backward and it is the same word. 111 is a palindrome number.

In order to make a program to capable of deciding if a word is a palindrome or not, I had to use strings in C++. I made four strings and a string function.  Two were really important, string palabra and string backwards. On string palabra the program stores the word provided by the user, and on string backwards it stores it backwards.

The process made to store the word backwards was done with a for loop. The parameter to continue the for loop was the length of the string palabra, which I stored on an integer variable called largo. To get that value, you just write the name of the

for loop

Continue reading “Quiz 5”