Solving some issues commented by the students.

This commit is contained in:
sergiotarxz 2021-04-06 17:48:16 +02:00
parent 676d183c39
commit dcda6a1955
Signed by: sergiotarxz
GPG Key ID: E5903508B6510AC2

View File

@ -1,4 +1,4 @@
uses sysutils;
uses sysutils,crt;
type
CostoArrayRow = array[1..3] of double;
@ -16,16 +16,16 @@ var
i, j: Int64;
begin
for i := 1 to Length(ESTACIONES) do
write(#9 + ESTACIONES[i]);
write(' ' + 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]));
write(' ' + IntToStr(cantidad[i][j]));
end;
write(#10);
writeln('');
end;
end;
@ -34,16 +34,16 @@ var
i, j: Int64;
begin
for i := 1 to Length(ARTICULOS) do
write(#9 + ARTICULOS[i]);
write(#10);
write(' ' + ARTICULOS[i]);
writeln('');
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]));
write(' ' + FloatToStr(costo[i][j]));
end;
write(#10);
writeln('');
end;
end;
@ -53,8 +53,8 @@ var
precio_por_cantidad: double;
begin
for i := 1 to Length(ESTACIONES) do
write(#9 + ESTACIONES[i]);
write(#10);
write(' ' + ESTACIONES[i]);
writeln('');
for i := 1 to Length(COSTES) do
begin
@ -63,18 +63,21 @@ begin
begin
precio_por_cantidad := 0;
for k := 1 to Length(ARTICULOS) do
precio_por_cantidad += cantidad[k][j] * costo[j][k];
write(#9 + FloatToStr(precio_por_cantidad));
precio_por_cantidad += cantidad[k][j] * costo[i][k];
write(' ' + FloatToStr(precio_por_cantidad));
end;
write(#10);
writeln('');
end;
end;
procedure printTables(costo: CostoArray; cantidad: CantidadArray);
begin
printCosto(costo);
writeln('');
printCantidad(cantidad);
writeln('');
printCostoPorEstacion(costo, cantidad);
writeln('');
end;
var
@ -83,6 +86,7 @@ var
i, j: Int64;
begin
ClrScr;
Randomize;
for i := 1 to 3 do
@ -95,4 +99,5 @@ begin
cantidad[i][j] := Random(2000) + 500;
printTables(costo, cantidad);
ReadKey;
end.