Initial commit.

This commit is contained in:
sergiotarxz 2021-04-05 22:34:57 +02:00
parent 949f3e7f73
commit 0ab89b9da9
Signed by: sergiotarxz
GPG Key ID: E5903508B6510AC2
1 changed files with 69 additions and 0 deletions

69
ejercicio1.pas Normal file
View File

@ -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.