Lp1 aula-5 array

download Lp1  aula-5 array

If you can't read please download the document

Transcript of Lp1 aula-5 array

  • 1. Tec. InformticaTec. Informtica Linguagem de Programao 1Linguagem de Programao 1 C#C# Aula 5Aula 5

2. Array (vetor)Array (vetor) Criando ArraysCriando Arrays A sintaxe bsica de um Array :A sintaxe bsica de um Array : tipo[ ] nome;tipo[ ] nome; nome = new tipo [tamanho];nome = new tipo [tamanho]; ouou Tipo[ ] nome = new tipo [tamanho];Tipo[ ] nome = new tipo [tamanho]; 3. Array (vetor)Array (vetor) Exemplos:Exemplos: Int32[] vetorNumeros;Int32[] vetorNumeros; vetorNumeros = new Int32 [10];vetorNumeros = new Int32 [10]; String[] vetorNomes = new String [10];String[] vetorNomes = new String [10]; 4. Array (vetor)Array (vetor) Agregar valores no ArrayAgregar valores no Array String[] vetorNomes = new String [10];String[] vetorNomes = new String [10]; VetorNomes[0] = Jos;VetorNomes[0] = Jos; VetorNomes[1] = Luiz;VetorNomes[1] = Luiz; VetorNomes[2] = Hugo;VetorNomes[2] = Hugo; 5. Array (vetor)Array (vetor) Agregar valores no ArrayAgregar valores no Array String[] vetorNomes = new String [10];String[] vetorNomes = new String [10]; For (i=0; i