Author Archives: Tania Pardo

#Mastery11

Using functions is useful to organize your code because these allows that your program has a structure divided by segments.

When you want to call a function is really simple because you only need to write the name of the function and the parameters.

Here you can see a program that calls functions:

I did a pp to explain how to call functions, I hope you find it useful, this is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvdFg3TnZCb2NnYXM/view?usp=sharing

Here you can find my c++ code:

https://drive.google.com/file/d/0B-NM4ghaDXBvREdHM1VwbjJqVEU/view?usp=sharing

#Mastery20

“For” loop is really useful to execute a part of code a specific number of times, this loop works like “while” loop, and it has a very simple structure that basicaly has init, condition, increment and the statement that will be executed the number of times that the user wants.

Here you can see some pictures about how this conditional works:

In the following link you will find a pp that was made by me to teach how to use this loop:

https://drive.google.com/file/d/0B-NM4ghaDXBvOGplRlNTTFlYVjQ/view?usp=sharing

And in this link you will find my c++ code:

https://drive.google.com/file/d/0B-NM4ghaDXBvd0NlMGFUVGhwQk0/view?usp=sharing

Finally, I share with you this link where I found useful information about this loop:

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

#Mastery17

This mastery is useful to learn a different conditional, I explained “else”, “if” and “else if” conditionals before, but in this post I am going to explain “SWITCH” conditional. This conditional works as “if” conditional, but I think that it is easier to understand, because the structure is simpler.

I did a program that shows how this conditional is used, here you can see a picture about that:

Also I did a pp to explain this conditional, this is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvc0NvdnkxVk9GdFk/view?usp=sharing

And you can find my c++ code here:

https://drive.google.com/file/d/0B-NM4ghaDXBvd0gtVGxYWnRiSVE/view?usp=sharing

Finally this links were useful for me and you could find them interesting and useful to learn more about “switch”:

https://adolfredobelizario.wordpress.com/2012/06/19/tutorial-5-lenguaje-c/

http://aprende-a-programar-ya.blogspot.mx/2011/08/estructura-condicional-multiple.html

 

#Mastery10

Input and output are really used in programming, because they are useful to “print” something and to “give” values.

Here you can find a really simple example of this.

Also, I did a pp to explain this with more details. Here is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvQV82TE9YSlY1UXc/view?usp=sharing

And I found useful information in this link:

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

#WSQ09

This program is useful to calculate a factorial. First of all the program asks for a non negative integer and then it calculates the fatorial. Next the program will ask you if you want to enter other number to calculate the factorial, and the program will calculate as many factorials as you want. The interesting thing here is that you need to VALIDATE a yes/no question, because the code will be excecuted as many times as the user wants. I used WHILE and FOR loops to do that because I think that is the easiest way to do this.

Here you can find my code and de program working:

And this is the link where you can find my code:

https://drive.google.com/file/d/0B-NM4ghaDXBvQTlDUk9sTTF3czg/view?usp=sharing

#WSQ08

In this WSQ we had to create and call functions; this is really useful because you can do an action doing different actions and writting the code in a different way.

In this link you can find my c++ code:

https://drive.google.com/file/d/0B-NM4ghaDXBvVVI2Nmw3bUNVb0U/view?usp=sharing

And here you can see two pictures about my code and the program running:

#Mastery18

For this mastery we demonstrate to have the ability to use nested conditionals, this is really simple because we know how to use “basic” conditionals and it is almost the same thing.

In this link I found useful information about nested conditionals:

http://www.programiz.com/cpp-programming/if-else

Also I made a program to explain this easier.

You can find my code in the following link:

https://drive.google.com/file/d/0B-NM4ghaDXBvTDJfWUluZ2gtdlE/view?usp=sharing

And here are some pictures, the first one shows my code and the second one is the program running.

Finally, I want to share a link where you can find a pp that explains nested conditionals. I hope you find it useful:

https://drive.google.com/file/d/0B-NM4ghaDXBvLVYwTDE4cFl1Q00/view?usp=sharing

#WSQ06

This is a very interesting activity because you need to use conditionals, loops and different libraries.

To learn something about libraries I found this link that helped me a lot:

http://www.marcsdev.com/2012/09/obtener-numeros-aleatorios-en-c-rand.html

Here are some pictures, in the first one you find my code and he second one shows the program working.

Also, you can find my c++ code here:

https://drive.google.com/file/d/0B-NM4ghaDXBvU0ZnaUhmb1lpb1U/view?usp=sharing

#WSQ07

For this actitvity we had to make a code that asks for a range of numbers and then it calculates the sum of the numbers in that range.

Here are some pictures about my c++ code and the program working.

Notice that I found two ways to make this program because you can use for or while and the program is going to execute the same actions.

You can find my c++ code here:

https://drive.google.com/file/d/0B-NM4ghaDXBvVTJSb3d2bGpqdTg/view?usp=sharing

And you can find useful information here:

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

#Mastery19

Loops are really important and useful, that is because they are used to repeat a secuence of code WHILE a condition given is true.

I found some information in the following links:

https://programacionfusa.wordpress.com/miprueba/sentencia-while/

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

I did a pp to explain “WHILE”, there you will find information to use “WHILE” and the structure of it. Here is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvN25RcDBRYW95c00/view?usp=sharing

And in this link you will find my c++ code:

https://drive.google.com/file/d/0B-NM4ghaDXBvU01YUjF2dkFyUkE/view?usp=sharing

Here is a picture of my code: