Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test27
//fpc 3.0.4 {record with variable part "case"} program test27; type fig=(circle,quadra); Pfig=^Figure; Figure=record sled: Pfig; case f:fig of circle:(r:real); quadra:(a,b:real) {"a" gets the space of "r"} end; var m,q:Pfig; function square(x:Pfig):real; begin with x^ do case f of circle: square:=3.14*sqr(r); quadra:square:=a*b ; end; end; begin New(m); with m^ do begin sled:=Nil; f:=circle; r:=10; b:= 3; writeln(r:2:1); writeln(b:2:1); end; writeln(square(m):2:1) ; writeln; New(q); with q^ do begin sled:=m; f:=quadra; r:=2; {a:=1;}{"a" gets the space of "r"} b:= 3; writeln(r:2:1); writeln(b:2:1); end; writeln(square(q):2:1) ; writeln(square(q^.sled):2:1); Dispose(q); end.
run
|
edit
|
history
|
help
0
zadacha2
jhjj
ANDRESSA LIMA NEPOMUCENO 600624624
05 ariketa
Elevador Versão Pascal StringList
2
1
searchtree
a2
digits_count