Author Archives: Alan Valdovinos

#WSQ09 Factorial

In this task, we needed to create a program that ask the user for any nonnegative number to calculate its factorial and print the result on the screen. To do it, I used the for loop, a repetition control structure, which made things easier. Here is the program:

Code

The for loop has the following sintax:

for (init; condition; increment){

statements

}

In init, you can declare and initialize any loop control variables; in condition, the condition is evaluated and, if it is true, the body of the loop is executed, if false, it will stop; and, in increment, you can update any loop control variables.

Here’s the program being executed:

Code executed

To do this activiy, I consulted this web page: http://www.tutorialspoint.com/cplusplus/cpp_for_loop.htm

You can look at my code in my GitHub as well: https://github.com/alanvaldo/my-tc1017-stuff/blob/master/wsq9.cpp

Sum of numbers! #WSQ07

This programs ask you for two different integer numbers, then it will sum the integer numbers between this two numbers and both numbers. For example, if you chose 1 and 6, it wills sum 2, 3, 4, 5 and both numbers, 1 and 6, giving a total of 21. To write the code, I had to use the function while. You can also use do-while or for, these three functions works for the program, though each one of them have advantages over the others. I also use this simbols after a variable: ++. Their function is to increase for one the variable every time the loop repeats.

Here is the code:

Here is the code executed

Guess a number! #WSQ06

This program generates one random number between 1 and 100 and you have to guess it. It will tell you if you have to pick a lower number or a highier number until you guess it the program will finish. You win if you try less than five times, if not, you lose. To write this program I had to include two new libraries besides iostream, to use the function srand, which helps to generate the random numbers: they are cstdlib and time.h.

Here is the code:

 

Here is the program executed:

#WSQ04 My BIO

Look above to see my background.

Temperature #WSQ05

1 min read

This program includes the conditionals if and else. Basically, you establish a condition, if it’s true the program will do a series of actions you want it to do and, if it’s false, will do other series of actions determined by you. The way to write conditionals is like this:

if(condition)

{

series of actions if true

}

else

{

series of actions if false

}

 

The program below asks the temperature in Farenheit, then it converts it to Celcius and finally it prints in the screen a text that says if the water boils or not, depending on the temperature the user introduced at the beginning.

Here’s the program executed introducing two temperatures, 32 ºF (water does not boil at this temperature) and 212 ºF (water boils at this temperature).

To complet this task, I consulted pages 33 and 34 of the book “How to think like a computer scientist” by Allen B. Downey.

Fun with numbers! #WSQ03

2 min read

This is a program that asks you for two numbers, you type them and then it calculates the sum, difference, product, division and the remainder of the division of the two numbers.Screenshot of my program

The first thing I did was to download a word processor called Notepad++, to write the code there and save it as a C++ source file. When saving the code, you need to give it the name you want and put at the end .cpp like this: yourprogram.cpp. This is necessary to enable the program to be compiled. Now that you named the file, you need to save it in the User’s folder located in: C:/cygwin/home/Users(your computer’s name). Now, open the Cygwin Terminal, write: g++ yourprogram.cpp and click enter. It won’t be compiled if your program have a sintax error and the black screen will return an error message, if it doesn’t have any, it won’t return anything, like in the image below.

Screenshot of cygwin terminal

Once your program is compiled, you can run it, just type: ./a.exe

and press Enter.

To save and run the code, I watched this video made by Mr. Ken Bauer.

https://www.youtube.com/watch?v=5lJ6evIAndo&list=PLhMUtn5hqperLvPZugufj25uy8KW9ZrNP&index=3

To write the code, I watched this one also made by Mr. Ken.

https://www.youtube.com/watch?v=JFncCPhD76M&feature=youtu.be&list=PLhMUtn5hqperLvPZugufj25uy8KW9ZrNP

In this video he explains how to print messages in the screen by using the object cout and this arrows << and he also explains how to save the input (what the person types), as a variable by using the objetc cin and the arrows >>.

I also consulted the pages 4-8 of the book ”How to think like a computer scientist” written by Allen B. Downey.

 

 

The flipped clasroom #WSQ02

2 min read

I think the flipped classroom is much better than the traditional one. It encourages students like me to watch the lectures, do the exercices, study and read the books outside the classroom. Then, if you have any question, you can ask the teacher about it. The teacher create original videos about the content of the class, you watch them at home and then you reinforce what you learn with dinamical, fun and hands on expiriences at the classroom. That’s great compared to a boring class in which the teacher just talks and writes on the white board thinking that everyone needs some knowledge that many of them might already have. So the clasess get more students centered rather than teacher’s centered. The teacher spends most of the time in the students desk solving questions, helping or motivating us. That way, I feel like the teacher is an indispensable guide who can make my understanding of things a lot easier.
In coclusion, the class is for bookwork and home is for watching lectures. That way, there’s more time for the teacher to solve everybody’s doubts in the classroom and to apply quizzes and see who’s staying behind and why.

Here’s a great video I found that explains what the flipped class is not, because there are a lot of misconceptions about it.
https://www.youtube.com/watch?x-yt-cl=84924572&x-yt-ts=1422411861&v=hGs6ND7a9ac

Time to flip-learn!

#WSQ01

2 min read

To start programming I first need to install C++ and some other tools to get my computer ready to run it. But it’s a bit trickier than installing any program like Skype or Firefox. So, I wanna show you how I did it thanks to this great video made by a Canadian guy: https://www.youtube.com/watch?v=i2h_976SpV0.
This tutorial is intended only for Windows users.
First, you need to go to the Cygwin web:
http://cygwin.com/index.html
You’ll be directed to its home page, scroll down and you’ll see a title which says: Current Cygwin DLL version. Click on one of the links for installation to download the installer depending on your computer processing unit. If yours is 32 bits click on this link: setup-x86.exe or, if it’s 64, click on this one: setup-x86_64.exe
Then double-click on the installer you just downloaded from the folder you use to save your downloads. Now, just click next in every window that pops up until the window Cygwin Setup – Choose Download Site(s) appears. There, select any site, it doesn’t matter, and click add and then click next. Wait until the green bar loads and click next again. The next window shows all the packages you can install, just select two of them gcc-g++ and make. To select them use the filter located in the left corner above and type the name of the packages. Type gcc-g++ and select the second skip from top to bottom and the two n/a will become squares, the left one will be crosed. Now type make in the filter and now do the same thing but now select the second from bottom to top. Then click next and wait for the green bars to load completely. Finally click finish and you are ready to start programming!

#WSQ00

1 min read

Here’s is my signature where I agree the terms of page one:

http://ken.baueralonso.com/courses/course-home-page-for-tc1017/tc1017-page-one/#comment-22 

#mastery03

1 min read

My twitter accout is @alanvaldovinos, mi GitHub ID is alanvaldo and I’m posting from Known. #TC1017