Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
practica 7 ejercicio B2
program HelloWorld; {-----------------------------------------------------------------------------------------------------------------------} {----------------------------------------------------------------- CONST - Define las constantes para usar en tiempo de compilacion} const DimF = 15; {-----------------------------------------------------------------------------------------------------------------------} {-----------------------------------------------------------------------------------------------------------------------} {----------------------------------------------------------------- TYPE - Define los tipos creados por el usuario para usar en tiempo de compilacion} type indice = 1 .. DimF; Tvector = record vector : array [indice] of integer; DimL : indice; end; {-----------------------------------------------------------------------------------------------------------------------} {-----------------------------------------------------------------------------------------------------------------------} {----------------------------------------------------------------- VARIABLES GLOBALES - Define variables que se podran usar por todos los modulos de ser necesarias} //var {-----------------------------------------------------------------------------------------------------------------------} {-----------------------------------------------------------------------------------------------------------------------} {----------------------------------------------------------------- CARGAR VECTOR} procedure cargarVector(var v : Tvector); var i : indice; begin randomize; for i := 1 to DimF do v.vector[i] := random(33); v.DimL := DimF; end; {----------------------------------------------------------------- IMPRIMIR DECENA} procedure imprimirDecena(n:integer); begin if n > 9 then begin write(' | ',n); end else write(' | 0',n); end; {----------------------------------------------------------------- IMPRIMIR DECENA 2} procedure imprimirDecena2(n:integer); begin if n > 9 then begin writeln(' | ',n,' |'); end else writeln(' | 0',n,' |'); end; {----------------------------------------------------------------- IMPRIMIR DECENA 3} procedure imprimirDecena3(n:indice); begin if n > 9 then begin write(' ',n); end else write(' 0',n); end; {----------------------------------------------------------------- IMPRIMIR VECTOR} procedure imprimirVector(v : Tvector); var j : indice; begin for j := 1 to v.DimL do write('-----'); writeln; for j := 1 to v.DimL-1 do imprimirDecena(v.vector[j]); imprimirDecena2(v.vector[v.DimL]); for j := 1 to v.DimL do write('-----'); writeln; for j := 1 to v.DimL do imprimirDecena3(j); writeln; end; {----------------------------------------------------------------- REDUCCION} function reduccion(v:Tvector;i,j:indice):Tvector; var h,a : indice; begin for h :=j downto i do begin for a:= h to v.DimL-1 do v.vector[a]:=v.vector[a+1]; v.DimL := v.DimL - 1; end; reduccion := v; end; {-----------------------------------------------------------------------------------------------------------------------} {-----------------------------------------------------------------------------------------------------------------------} {----------------------------------------------------------------- PROGRAMA PRINCIPAL} var v : Tvector; i,j:indice; begin cargarVector(v); imprimirVector(v); randomize; j:= random(DimF)+1; i:= random(j)+1; writeln('borrar elementos entre ',i,' y ',j ); imprimirVector(reduccion(v,i,j)); end. {-----------------------------------------------------------------------------------------------------------------------}
run
|
edit
|
history
|
help
0
the answer is the last result
nomer2
1
For5
числа с несовпадающими цифрами
Tri 1.0
Calculatrice 1.0
programme 2
nomer3
tablas