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; {change appointed element with new element "d"} 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
Урок 3 задача на вывод 1 и 0 как функция целого
Calcular digitos de un numero (hasta 4 digitos)
09 ariketa
homework
Heron Equationヘロンの公式
rf cdx
practica 3 ejercicio B5
Урок 3 задача 1 повышенная сложность. Задача 1484. Усложнённая.
Primo1
ahoj