Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152
Ricardo Newton’s Articles at TC101 Fall 2015, Page 3
Introduction to Programming Python and C++

Author Archives: Ricardo Newton

#Mastery06 – Install Linux on their own computer

Hello this is on how to download and install Linux in your own computer. Linux is a very free operating system which can be downloaded without cost. You don’t even have to download it directly to your hard drive, instead you can do it on a USB if you prefer to.

Installing Ubuntu on a USB for Windows:

 

First you will need a USB with at least 2GB of free space. How can you put it on the stick? Use the installer in Pendrivelinux.com download the installer and follow the steps…

 

1.     1. Choose Ubuntu from the list

2.     2. Click on browse to open the file.

3.     3. Choose the USB you are going to be using and do a click on create.

 

How can you make a removable USB stick for your Mac? Easy.

1.     1 .Download Ubuntu Desktop.

2.     2. Open the Terminal

 

 

 

 

 

3.     3. Convert the .iso file to .img using hdiutil

4.     4. Try to run it.

5.     5. Then you have to insert your flash media.

6.     6. Run and execute.

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

To boot up your mac using linux, restart it and press alt/option to choose the USB stick

#Mastery23 – Creation and use of vectors in C++

This is about creating and using vectors in C++. A vector in c++, is used to store different values in different storage compartments. It works almost the same as an array, the only difference is that the storage space can change. This is one of the differences with the arrays that storage spaces have to be declared.

 

Vectors take more memory space than arrays do. It is a list of values in which each of them are identified with a number. They can be made by any element and type.

These is how you declare a vector.

 

       You declare de type inside the angle brackets.

       You can declare the size of your vector in between parenthesis ( 6).

   

             Vectors can be represented in the same way as arrays, like in a table.

       The count of vectors starts in 0.

 

Now you have located your values inside vectors, how can you access them? It is using the [ ]. You can give some space a value like this:

 

count[4]= 60;

 

The best part of using them is that its size can be modified.

 

           The copy constructor takes one vector and copies it in the same size.

 

   –       You can involve functions with a vector, like size( ). This function gives the size of a vector.

 

Vectors can also be used to create random numbers. Computers are designed to always return back any result with the same process, this is a problem when you are looking for the computer to show up a random number. C++ has a function called random that does all this process for you.

 

It is important to learn how to make use of the different facilities c++ have for you. You just need to be very careful when using them.

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

WATCH MY VIDEO https://youtu.be/XRxkoby_RUE

#Mastery24 -Creation and use of arrays in C++

Hey there! This is that is about the creation and the usage of arrays in c++. Arrays are different numbers with the same type placed in separate spaces. It is like to fill drawers with information to use them after. This is used instead of declaring individual variables.

 

Let´s say you want the program to ask for 10 various numbers separately and then get the total of them, in this case you can use arrays. The only “disadvantage” of using an array is that you have to define the number of values to introduce.

Using arrays is easier than it sounds.

 

To understand its use, it is better to imagine them as boxes you are saving info into:

 

0

1

2

3

4

5

6

7

8

 

 

 

 

 

 

 

 

 

 

An array starts it´s count from the box number 0. Declaring an array is as easy as declaring some other thing. The structure of an array is like this:

 

type  nameofarray [number of spaces];

 

       An array can be any type just as a normal variable, but it is a arrangement of variables.

       You can choose whichever name you want for your array.

       The number in between the squared braces [ ] is to set the number of values introduced in the array.

       The number of spaces in the array has to be an integer because it is a whole unit space.

 

The elements of an array can be used to be introduced by the user of the program, or you can type them after declaring in between braces= { }.

 

Then when you want to use the values already stored inside an array, you have to simply type the nameofarray[ number of space of the value]. Be aware that the space number 0 counts as a space.

 

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
table.MsoTableGrid
{mso-style-name:”Tabla con cuadrícula”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-priority:39;
mso-style-unhide:no;
border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .5pt;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-border-insideh:.5pt solid windowtext;
mso-border-insidev:.5pt solid windowtext;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

WATCH MY VIDEO https://youtu.be/XekmFL6VBwI

#Mastery12 – Creating C++ functions

Hello! This is about creating functions on c++. Actually, creating a function is pretty simple and easy to learn. First, let´s start defining a function. A function, is basically a group of commands arranged inside by a phrase or word that you choose. There are different kinds of functions. C++ has a list of different functions already made and available to use but you can always create your own too.

 

How to create a function? Very easy!

The structure of a function consists in…

 

A type  name ( conditions) { and coding that you want the function to proceed with

 

       A type would be for example: long, double, or integer.

       The name can be almost anything you want, except for the ones already used by c++ to perform another task.

       The values are the things you are declaring.

       and then in between {} you have to type whatever you want the function to do.

 

Here is an example of a function:

 

A function is usually written before and outside the main( ).  Functions are used to isolate different processes in a program. Here´s an example of a simple program; one that works with a function and one that doesn’t and they both do the same.

 

There are different types of functions, for example void doesn’t return any value. For functions that do return values there are different types like double, char, bool, string… When using functions that return values, make sure you make the compiler know to what value return like return a; or return x;

 

To call the function into the main() you can use a cout and type your function.

 

Here´s an example of a non-void function.

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

                     

  TIPS:

– Remeber to maintain the same type in the same variables on your function.

– Be careful with the braces and were to put them. Always close the function before typing the main( ).

– Be careful with what values you want your function to return… Example: return a; or return 0;

– Be aware that the function name you create can be used on c++ for another thing like main ( ).

– Remeber that if the program compiles, it does not mean it works so make sure you test your program in the compiler.

WATCH MY VIDEO https://youtu.be/NOLXBXg-yik

#WSQ10 – Lists

– I did this one with arrays because they are easier for me, I searched first how to use arrays and that was it. The only disadvantage is that you have to determine the number of values for the user to introduce. It may seem larger to code but it is easier to understand.

Here’s my code in github https://github.com/ricardonewton/TC101/blob/master/lists

 

#WSQ09 – Factorial Calculator

. This task was easy, it was all about using loops. At first, I couldn´t get it working all answers returned me 1 until I realized there was a missing “}”. When using loops, always be careful with the information you type inside of the ( ). I often use > instead of the other one which makes all the program stop working. I’ll link my code on github.

 

QUIZ 8

#QUIZ8https://github.com/ricardonewton/TC101/blob/master/q1.cpp

QUIZ 7

#QUIZ7https://github.com/ricardonewton/TC101/blob/master/fibonaccihttps://github.com/ricardonewton/TC101/blob/master/palindrome

#WSQ08 – On to Functions

Hello! This is in which we had to basically repeat what we did in WSQ03 but with the use of functions. I had problems again with the use of syntax, I freaked out but it was all about the semicolumns and symbols like those.

Remeber, when using functions, to declare the variables with the type you need. Int for whole numbers, Double for decimals etc. Also make sure the names you use to create your functions are not used in c++ language for some other thing, becuase is you do, you may have some problems.

 

Here is my code in GitHub:

https://github.com/ricardonewton/TC101/blob/master/ontofuntions

#Quiz06

#Quiz06https://github.com/ricardonewton/TC101/commit/c7ae8fe3482c3c48f8dad25958169b04a2149a7chttps://github.com/ricardonewton/TC101/blob/master/stars

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).