Vectors are AWSOME!!!

Hello again, This blog is specifically dedicated to explain vectors since Ken already taught us how to use arrays. Vector are pretty cool, you can do a lot of things with them. This video show some of the things you can do with them. The video is pretty long but, all the important information is in the first 8 minutes.

Check out this PAGE so that you know how to do the standard deviation and what it is. The page is MathIsFun. Pretty nice website 🙂.

Of course I can’t forget the code:

List with arrays

List with vectors

Tutorial on vectors

YOU KNOW WHAT I’m gonna add some extra code, I was able to make a list of vector strings that organizes itself in alphabetical order. Here it is: List of organizable strings. For this code, I got help from this book: 

book

Here is my tutorial for vectors:

Made by Orlando Lara

§‡‡‡Quiz4‡‡‡§

Photograph credit

zxsq3

Hey guys, IT WORKS, but it isn’t perfect. I had a problem and I got around it but it isn’t fixed. The problem I had was this: Basically the user inputs a number like 0.00001 and my loop is supposed to multiply it by 10 until it reaches 1. Once that value reaches 1 then the loop is supposed to stop and tell me how many times the loop was run. The problem is that the value NEVER equals 1. I don’t know why that happens. If you guys know how to fix this, please help. Here is my code: with the loop that has the problem, the orginal and the one that prints out each value(so you can see what is going on with e):

LoopFunction.cpp

euler_calc.cpp

Quiz4.cpp

Screen Shot 2016-02-27 at 2.53.27 PM

This function tells me how many significant figures will be used to print out euler’s number.

Screen Shot 2016-02-27 at 3.08.35 PM.png This function simply gets the factorial of a number.

Screen Shot 2016-02-27 at 3.10.22 PM.png

With this function I calculate the value e, in my loop you will notice that my conditional is pre>x. well x is the number given by the user to know how many significant figures to use for e. pre is the difference between the previuos and the actual value of e. so if x=0.0001 then the loop will continue until pre(the difference of the previous and actual value of e) is less than 0.0001.

You will probably notice that I have a command that says set precision(26). This just makes the program print out the number with that many significant figures.  I look here
for that command.

⁄⁄⁄⁄⁄⁄⁄⁄⁄⁄Quiz3⁄⁄⁄⁄⁄⁄⁄⁄⁄⁄

Photograph credit

Hi guys, you know I always make a video about wsq’s and quizzes. This time we had to make two programs in quiz 3, the distance program and the fibonacci program. Well I decided not to make a video about the distance program because it’s really not that difficult, instead I made a video about the two ways to make the fibonacci program. First I explain how to do it wit recursion and then with loops. Be sure to take a look at Ernesto’s Blog too

Alexhfoo’s blog: This guys blog is pretty cool, check it out.

Link to the Quiz

code:

Distance.cpp

Fibonacci.cpp

FibLoop.cpp

FibRecur.cpp

Ok for the Distance program I used these images to help visualize what is going on:

imagesimages

As you can see, that line is the distance we want to know, it is the hypotenuse if you look at the picture as a right triangle. So in our program we obviously have to use a squared function and a square root function. Those are pow() and sqrt() respectively. I got these functions from here. It is pretty simple, take a look at my program so you can see one way of doing it.

Here is the video about recursion

And here is my tutorial.

Made by Orlando Lara

⁄⁄⁄⁄Quiz 2⁄⁄⁄⁄

Photograph credit

Man, it has been a loooooong day and finally this is the last post that is due. Ok, just like the last post about the last quiz, I’m not gonna go into detail about how to make these programs, I’m just going to explain how they work. Here are some links for reference:

http://www.cplusplus.com/doc/tutorial/introduction/

http://www.tutorialspoint.com/cplusplus/cpp_templates.htm

Code:

Stars.cpp

Superpower.cpp

In this quiz we have to make 2 programs, the first one is called stars and the second one is called superpower. In star we have to make a function that prints out the number of stars that the user asks for. In superpower we basically raise a number to the something power. In this last one you can do it with a loop or with recursion. I personally don’t like recursion and decided to do my program with a loop. In my tutorial a explain my program that uses a loop, but I promised I would share a video from someone else to help explain how to do it with recursion. Here it is.

And here is the explanation on hoy my programs work, enjoy.

Made by Orlando Lara

⁄⁄⁄Quiz 1⁄⁄⁄

Photograph credit

Well quiz 1 really woke us up didn’t it? We had to do three programs in one quiz. This time is different from my previous posts. Usually I give a link to my original, more complex code and a link to a simpler code that gets the job done. This time I’m not gonna make a tutorial but rather explain how my programs work and why they work.

The first one is to calculate the volume of a cylinder, the second is to do a program similar to WSQ03 using type int and the last one was the same as the second one expect using type float.

code:

Prog1.cpp

Prog2.cpp

Prog3.cpp

Here is the quiz(I got it from ALEXHFOO‘s BLOG): captura-de-pantalla-2016-02-09-a-las-11-50-01

And now for the explanation on how these programs work.

Made by Orlando Lara

 

Fact or Real (yes, it means the same)

Photograph credit

I know, dumb title. I couldn’t come up with anything else and I really did not feel like naming this blog “Factorial”. So it is what it is. Ok This is the last WSQ until now, if any of you guys have not done this program well I hope this helps. I tried to make my to tutorial short and simple to understand.

code:

Factorial.cpp

FactorialCalculator.cpp

If you have any questions, just ask, I’m happy to help. My name is Orlando Lara and I’m in Ken’s TC1017 class at 10:00 Tuesdays and Fridays. Here are some links to help you out:

http://www.cplusplus.com/doc/tutorial/introduction/

http://www.tutorialspoint.com/cplusplus/cpp_templates.htm

In my tutorial I show you how to do the factorial with a loop and function but you can also do it with recursion. Here is a very useful video about that.

Remember that a program can be as complicated as you want. In this tutorial I just show the basics of how it works and one way of successfully making the program but this is too simple. You have to make it more elaborate. Which is why a gave you two links of codes at the beginning of the blog. The first one is the one that appears in the tutorial and the second one is my original code in case you want to take a look at it and get some ideas.

Made by Orlando Lara

Einstein can Add

Photograph Credit

Einstein has nothing to do with the program 🙂, I just thought it would catch your attention. As always look at this pages for reference:

http://www.cplusplus.com/doc/tutorial/introduction/

http://www.tutorialspoint.com/cplusplus/cpp_templates.htm

And here is my code, simple and complex respectively:

Sum.cpp

SumOfNumbers.cpp

In my tutorial at the bottom I show you how to do this program with loops but there is another way of doing it. That is Recursion. Here is Bucky’s tutorial on how to do that. By the way, you should go and check out his other tutorial as well.

Made by Orlando Lara