Anda di halaman 1dari 8

CARRERA DE INGENIERA DE SISTEMAS

SEMESTRE ACADMICO 2011- II



Agosto 2010
METODOLOGA DE LA
PROGRAMACIN
SESIN 9
USOS DE LOS ARREGLOS
ING. MANUEL GUTIRREZ AGUIRRE
CARRERA DE INGENIERA DE SISTEMAS
ARREGLOS MULTIDIMENSIONALES
Un arreglo multidimensional es un arreglo de varios arreglos
unidimensionales que forman una matriz de valores.
CARRERA DE INGENIERA DE SISTEMAS
ARREGLOS MULTIDIMENSIONALES
CARRERA DE INGENIERA DE SISTEMAS
ARREGLOS MULTIDIMENSIONALES
CARRERA DE INGENIERA DE SISTEMAS
DECLARACIN DEL ARREGLO
<Visibilidad> <Tipo de Dato>[ ][ ] <Nombre de Arreglo>
=
new <Tipo de Dato> [<Dimensin 01>] [<Dimensin 02>];
CARRERA DE INGENIERA DE SISTEMAS
CARGA DE DATOS
int [ ][ ] a = new int [3][2];
for ( int i = 0 ; i < a.length ; i++ )
{
for ( int j = 0 ; j < a[i].length ; j++)
{
a[i][j] = i * j;
}
}
CARRERA DE INGENIERA DE SISTEMAS
VISUALIZACIN DE DATOS
int matriz[][];
matriz = new int[4][4];
for (int x=0; x < matrix.length; x++)
{
for (int y=0; y < matriz[x].length; y++)
{
System.out.println (matriz[x][y]);
}
}
CARRERA DE INGENIERA DE SISTEMAS
UBICAR UN ELEMENTO DEL ARREGLO
Para leer el contenido de un elemento
int x = matriz[1][3];

Para asignar un valor.
matriz[4][2] = x;

Anda mungkin juga menyukai