vetor e matriz

10
ALGORÍTMO Os arranjos (arrays) são estruturas n- dimensionais. Iremos abordar os arranjos unidimensionais, conhecidos como vetores e os arranjos bi-dimensionais, conhecidos como matrizes.

Upload: edblack1

Post on 16-Jan-2016

215 views

Category:

Documents


0 download

DESCRIPTION

Aula de Pascal

TRANSCRIPT

Page 1: Vetor e Matriz

ALGORÍTMO

Os arranjos (arrays) são estruturas n-dimensionais. Iremos abordar

os arranjos unidimensionais, conhecidos como vetores

e os arranjos bi-dimensionais, conhecidos como matrizes.

Page 2: Vetor e Matriz

ALGORÍTMO

Estruturas de dados composta

Os tipos estruturados são construídos a partir dos tipos primitivos.

Permitem a uma variável armazenar múltiplos valores de um mesmo tipo primitivo

Acessa N... Posição...

Page 3: Vetor e Matriz

ALGORÍTMO

Declarando vetoresvar

<identificador> : array[limiteinferior .. limitesuperior] of <tipo dos elementos>;

VETOR

Page 4: Vetor e Matriz

ALGORÍTMO

VETOR

real : idade

real : idade(5)

real : idade(10)

Page 5: Vetor e Matriz

ALGORÍTMO

varvet1: array[2..7] of integer;vet2: array[-3..2] of char;vet3: array['A'..'F'] of real;

type tipovetor = array[1..6] of integer;varvetor : tipovetor;

VETOR

Page 6: Vetor e Matriz

ALGORÍTMO

vet1[2] := 3;

vet2[0] := 'B';

vet3['A'] := 3.2;

VETOR

Page 7: Vetor e Matriz

ALGORÍTMO

Declarando matrizes

var

<identificador>:array[l1..l2,c1..c2] of <tipo dos elementos>;

MATRIZES

Page 8: Vetor e Matriz

ALGORÍTMO

MATRIZES

Page 9: Vetor e Matriz

ALGORÍTMO

Var

Matriz1: array[1..5,1..5] of integer;

Matriz2: array[1..3,1..8] of char;

MATRIZES

Page 10: Vetor e Matriz

ALGORÍTMO

Atribuindo valores as matrizes

Matriz1[1,2]:=0;

Matriz2[3,8]:='A';

MATRIZES