Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test28
program test28; {pointer example of direct chain growth and key inf change} type spisok=^elem; elem=record inf:real ; sled:spisok end ; label 1,2; const M:integer = 5; var a, pervy,d,l: spisok ; mas: array[1..5] of integer ; i,r:integer ; b:boolean; procedure sostavlenie2(var p1:spisok; N:integer) ; var q,p2:spisok ; begin New(q) ; {data generator} p1:=q; {head safe} p2:=q; for i :=1 to N do begin q^.inf:=mas[i] ; q^.sled:=Nil; p2^.sled:=q; p2:=p2^.sled; New(q); end ; end ; begin M:=5; for i:=1 to M do mas[i]:=i ; sostavlenie2(pervy, M) ; a:=pervy ; l:=a; r:=0; b:=true; New(d); {make new element} d^.inf:=10; d^.sled:=Nil; while (a<> nil) and b do if a^.inf=3 then {appoint the element} begin b:=false; {key inf achieved} if r>1 then for i:=1 to r-1 do l:= l^.sled; l^.sled:=d; d^.sled:=a^.sled; {insert new element "d" after appoined element} {Dispose(a); a:=pervy;} end else begin a:=a^.sled; if a=Nil then goto 1 ; r:=r+1; end; begin writeln('Appointed element is ',a^.inf:2:1) ; {show appointed element} writeln; a:=pervy; repeat writeln(a^.inf:2:1) ; a:=a^.sled; until a=Nil; goto 2 ; end; 1: writeln('no such key info element'); 2:end.
run
|
edit
|
history
|
help
0
Obrni listu
1
For10
число пи с помощью ряда
pares entre a y b
Pascal_uzdevumi
practica 3 ejercicio 3
2
Урок 2 задача не из учебника1
Бассейн-8 count