Tag Archives: #Mastery24

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

Creation and use of arrays in C++ 1017 24

An array is a data structure, or more technically, a memory that stores a collection of items, all of the same type. Should imagine an array as a contiguous sequence of cells (memory spaces), or squares, each of which can save an item from the collection. Also, it is usual to draw as illustrated by the following figure:

This figure represents an array of seven squares each of which can be used to store a data. The dimension or size of an array is the number of cells that comprise it. It should be clear, then, that the above figure corresponds to an array of dimension 7.

Example of dimension

 

In 2 dimension be like

 

At the beginning I was thinking like how to do a sudoku in this way so here is and example

 

STEPS!!!

  1. Type of Variable
  2. Write array
  3. Name of the array

EXAMPLE:

     float array [A];

In this Code that I did, I wrote some comments explaining what it means each line 

LINKS that I Used to explain and do my WSQ’s and this awesome Mastery 😀

http://dis.unal.edu.co/~programacion/book/modulo3.pdf

https://www.youtube.com/watch?v=gCBpGyKyaGU

http://es.slideshare.net/jhonnyspch/arreglos-c

Mastery24

This is my video for Mastery24

https://www.youtube.com/watch?v=M9Aq4f-0zlU

24

Mastery24:: Creation and use of arrays in C++

24 

1017

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

That means that, for example, five values of type int can be declared as an array without having to declare 5 different variables (each with its own identifier). Instead, using an array, the five int values are stored in contiguous memory locations, and all five can be accessed using the same identifier, with the proper index.

#Mastery24

Creation and use of arrays in C++

Primero llamamos a la libreria asi como usamos using namespace std; 

Definimos nuestra funcion principal INT MAIN. A continuacion definimos nuestros arreglos y su capacidad o tamaño de arreglo. Asignamos un nuevo valor al elemento en la posicion uno del arreglo. 

Imprimimos todo el elemento en el arreglo con un loop (en este caso usaremos un for) y nos va a imprimir todos los elementos que esten dentro de nuestro array.

Por ultimo terminamos todo lo que este corriendo en el int main y por ultimo compilamos y corremos para ver que no haya ningun error.

Aquí esta un ejemplo del programa corriendo:

24

 

#Mastery24

#mastery24 Creation and use of tuples in Python

A tuple is an unchangeable sequence of values.

x=(“Gilberto”,18,”ISC”)   tuple is written with ()

When you do this you create a tuple with three elements. You can access these elements individually by typing the variable and the then inside brackets directly to the right of the variable type the number of the element to which you are referring.

print (x[o])

>>>Gilberto

Python starts numbering at 0 so Gilberto=0,18=1 and ISC = 2

Packing and Unpacking:

In tuple packing, the values on the left are ‘packed’ together in a tuple:

x=(“Gilberto”,18,”ISC”)

In tuple unpacking, the values in a tuple on the right are ‘unpacked’ into the variables/names on the right:

x=(“Gilberto”,18,”ISC”)

(Name,Age,Studies) = x

print(Name,Age,Studies)

>>>Gilberto 18 ISC

Sources for info. about tuples: Link

 

1014

24

Gilberto Rogel García

Mastery24

Mastery24
here is my video http://youtu.be/m-xyJoP4S0A

Mastery24

Mastery24
here is my video http://youtu.be/m-xyJoP4S0A

Mastery24

Mastery24
here is my video http://youtu.be/m-xyJoP4S0A

Mastery 24

Here is my video for the mastery24.

Video: http://www.youtube.com/watch?v=jR7H9gwvLWE

1014 24