Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test04
program test04; {pointer example of direct chain growth and key inf choice} type spisok=^elem; elem=record inf:real ; sled:spisok end ; label 1,2; var a, pervy,d,h : spisok ; mas: array[1..3] of integer ; M, i: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:=7; for i:=1 to M do mas[i]:=i ; sostavlenie2(pervy, M) ; h:=pervy ; repeat writeln(h^.inf:2:1) ; h:=h^.sled; until h=Nil; a:=pervy ; 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} d^.sled:=a^.sled; {insert new element "d" after appoined element} a^.sled:=d; end else begin a:=a^.sled; if a=Nil then goto 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
Pokazivaci, ulancane liste
Поиск вершин в горах
Vremenska prognoza
Llenar un arreglo (con for)
факторизация 2019
P170815A - Cálculo da massa de um tanque
zad27-optimal
Naloga 8: 10.9.2008
Урок 2. Функции
test