Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test27b
//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 {"f" is an ordinal (!) record field of choice "case"} 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); Dispose(m); end.
run
|
edit
|
history
|
help
0
Helpme
For5
DOKIMH-2
BubbleSor (slimst)
Pi
66
registro de alunos, calculo de média
Llenar un arreglo (con for)
practica 8 ejercicio 1
Урок 3, задача 5 Задача 1478. Урок в неделе