Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.08 KB | None | 0 0
  1. with Ada.Text_IO;
  2. use Ada.Text_IO;
  3. procedure ejercicio_4 is
  4.    -- Definimos los tipos de datos
  5.    type A is array (0..14) of Integer;
  6.    type B is array (0..2, 0..9) of Float;
  7.    type C is array (Integer range <>) of Float; --<> indica indeterminado
  8.    Array1:A:=(others=>0);
  9.    Array2:B:=(others=>(others=>0.00));
  10.    Array3:C(1..13):=(others=>0.00);
  11. begin
  12.    --Imprimimos por pantalla el contenido de Array1
  13.    Put_Line("Array1:");
  14.    for I in Array1'Range loop
  15.       Put(Array1(I)'Img);
  16.    end loop;
  17.    Put_Line("");
  18.    --Imprimimos por pantalla el contenido de Array2
  19.    Put_Line("Array2:");
  20.    for I in Array2'Range(1) loop -- recorremos las filas
  21.       for J in Array2'Range(2) loop -- recorremos las columnas
  22.          Put(Array2(I,J)'Img);
  23.          if (J = Array2'Length(2)-1) then -- controlamos salto de fila
  24.             Put_Line("");
  25.          end if;
  26.       end loop;
  27.    end loop;
  28.    Put_Line("");
  29.    --Imprimimos por pantalla el contenido de Array3
  30.    Put_Line("Array3:");
  31.    for I in Array3'Range loop
  32.       Put(Array3(I)'Img);
  33.    end loop;
  34.    
  35. end ejercicio_4;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement