From 0ab89b9da9dcd77c4537bbc33463b53af6cff9fb Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Mon, 5 Apr 2021 22:34:57 +0200 Subject: [PATCH] Initial commit. --- ejercicio1.pas | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 ejercicio1.pas diff --git a/ejercicio1.pas b/ejercicio1.pas new file mode 100644 index 0000000..b106f68 --- /dev/null +++ b/ejercicio1.pas @@ -0,0 +1,69 @@ +uses sysutils; + +type + CostoArrayRow = array[1..3] of double; + CantidadArrayRow = array[1..4] of Int64; + CostoArray = array[1..3] of CostoArrayRow; + CantidadArray = array[1..3] of CantidadArrayRow; + +const + ESTACIONES : array[1..4] of string = ('Verano', 'OtoƱo', 'Invierno', 'Primavera'); + ARTICULOS : array[1..3] of string = ('A', 'B', 'C'); + COSTES : array[1..3] of string = ('Costo de materiales', 'Mano de obra', 'Otros gastos'); + +procedure printCantidad(cantidad: CantidadArray); +var + i, j: Int64; +begin + for i := 1 to Length(ESTACIONES) do + write(#9 + ESTACIONES[i]); + write(#10); + for i := 1 to Length(cantidad) do + begin + write(ARTICULOS[i]); + for j := 1 to Length(cantidad[i]) do + begin + write(#9 + IntToStr(cantidad[i][j])); + end; + write(#10); + end; +end; + +procedure printCosto(costo: CostoArray); +var + i, j: Int64; +begin + for i := 1 to Length(ARTICULOS) do + write(#9 + ARTICULOS[i]); + write(#10); + for i := 1 to Length(costo) do + begin; + write(COSTES[i]); + for j := 1 to Length(costo[i]) do + begin + write(#9 + FloatToStr(costo[i][j])); + end; + write(#10); + end; +end; + +procedure printTables(costo: CostoArray; cantidad: CantidadArray); +begin + printCosto(costo); + printCantidad(cantidad); +end; + +var + costo: CostoArray; + cantidad: CantidadArray; + i, j: Int64; + +begin + for i := 1 to 3 do + for j := 1 to 3 do + costo[i][j] := 0; + for i := 1 to 3 do + for j := 1 to 4 do + cantidad[i][j] := 0; + printTables(costo, cantidad); +end.