Arreglos
gerardo_alducin
Created on October 27, 2021
Over 30 million people create interactive content in Genially.
Check out what others have designed:
THE POETRY HIVE LOVES YOU!
Interactive Image
WHAT IS PRIDE?
Interactive Image
HOW TO BE AN ALLY TO TRANSGENDER AND NONBINARY PEOPLE
Interactive Image
THE STONEWALL RIOTS
Interactive Image
THE LEGALIZATION OF GAY MARRIAGE IN THE US
Interactive Image
HISTORY OF THE LGBTQ+ PRIDE FLAG
Interactive Image
AN INTRODUCTION TO LGBTQ+ TERMS
Interactive Image
Transcript
Un arreglo o array (matriz o vector) es un conjunto finito y ordenado de elementos homogéneos (del mismo tipo de datos). Ordenado quiere decir que podemos tener acceso a el primer elemento, al segundo, hasta el enésimo elemento (último). Una análogía usada para entender los arreglos es verlos como matrices en matemáticas.
Arreglo
Formato para declarar un arreglo: tipo nombre [tamaño]; Ejemplos: int numeros[10]; char letras[5]; float ventas[15];
Formato
Ejemplos: int numeros[]={1,4,6,7,3]; char letras[]={'a','b','c','d','e'}; Nota: Cuando inicializamos un arreglo no es necesario colocar el número de elementos.
Inicializar un arreglo unidimensional
EXPERIMENTA
EXPERIMENTA
Cuando j = 0
Cuando j = 1
Cuando j = 2
La analogía más cercana es con una matriz en el algebra matricial. Su declaración: tipo_datos nombre_arreglo [No. Filas] [No. de columnas]
Arreglo Bidimensional
int numeros [2] [3]; char letras [3] [2];
Inicialización de un arreglo bidimensional int numeros [2][3]= { {1,2,3} , {4,5,6}};
cout << numeros[1][2] cout << numeros[0][1]
cout << numeros[1][2]