Labsheet Pemrograman Lanjut Elektro
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
1.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 1 o f 10
C o m p e te n c y
A fte r
p r a c tic in g ,
s tu d e n ts
w ill
have
c o m p e te n c ie s :
k n o w in g ,
u n d e r s ta n d in g a n d a p p ly in g I D E ( In te g r a te d D e v e lo p m e n t E n v ir o n m e n t) D e lp h i
in c o m p u te r p r o g r a m m in g .
2.
S u b C o m p e t e n c ie s
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e s u b c o m p e te n c ie s :
a.
3.
K n o w in g p a r ts o f ID E D e lp h i.
b.
U n d e r s ta n d f u n c tio n a n d p r o c e d u r e o f e a c h p a r t o f ID E D e lp h i.
c.
A p p ly in g ID E D e lp h i to m a k e a s im p le p r o g r a m .
In t r o d u c t i o n
3 .1 . K n o w in g ID E D e lp h i
ID E D e lp h i c o n s is ts o f 6 m a in p a rts , w h ic h a re : M e n u , S p e e d B a r, C o m p o n e n t
P a le tte , F o rm D e s ig n e r, C o d e E d ito r a n d O b je c t In s p e c to r.
Speed Bar
O b je c t In s p e c to r
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
M enu
C o d e E d ito r
C o m p o n e n t P a lette
F o rm D e s ig n e r
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
a.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 2 o f 10
M a in M e n u
D e lp h i M a in M e n u h a v e s im ila r f u n c tio n
m e m ilik i k e g u n a a n s e p e r ti
m e n u p a d a a p lik a s i W in d o w s la in n y a . F ro m th is m e n u , y o u c a n o p e n
o r s a v e a p ro g ra m ,
r u n n in g a n d s e a r c h in g
p r o g r a m , e tc .
S h o rtly ,
e v e r y th in g th a t c o n n e c te d w ith I D E D e lp h i c a n b e c a lle d v ia m a in
m enu.
F ile
b.
E d it
S e a rc h
V ie w
P r o je c t
R un
C om ponent
D a ta b a s e
T o o ls
W in d o w
H e lp
Speed B ar
S p e e d B a r o r t o o lb a r c o n ta in s e t o f b u tto n th a t h a v e s a m e fu n c tio n w ith
m o s tly ite m m e n u .
c.
C o m p o n e n t P a le tt e
C o m p o n e n t P a le tt e c o n ta in s s e t o f ic o n th a t r e p r e s e n ts c o m p o n e n t s o f
VCL
(Visual Component Library). V C L is c o m p o n e n t t h a t c a n b e u s e d to
b u ild a n a p p lic a tio n .
S ta n d a rd
d.
A d d it io n a l
W i n 3 2 ] S y s te m
D a ta A c c e s s
D a ta C o n tro ls ] d b E x o r e s s ] D a ta S n a o
BDE
^ I *
F o rm D e s ig n e r
F o rm
D e s ig n e r is a p la c e to d e s ig n w in d o w s a p p lic a tio n . T h e D e s ig n is
p la c e m e n t o f c o m p o n e n t s fr o m C o m p o n e n t P a le tte .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
2k
e.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 3 o f 10
HD®
F o rm i
C o d e E d ito r
C o d e E d ito r is p la c e to w r ite p r o g r a m in P a s c a l L a n g u a g e . C o d e e d ito r h a s
a C o d e In s p e c to r, s o th a t w e d o n ’t h a v e to w r ite w h o le in s tr u c tio n . D e lp h i
h a s w r ite a b a s ic s tr u c tu r e o f a p r o g r a m . L o o k a t th e p ic tu r e b e lo w :
§3 U n it 1. pas
U n it l
►j
T F o rm l
+
_ l
V a r ia b le s /C o n s ta n ts
+
__ | U s e s
'
T
unit Unitl;
A
interface
uses
Windows, Messages, SysUtils, Variants,
Dialogs;
type
TForml = class(TForm)
private
{ P riva te d eclarations }
public
{ Public d ec la ra tio n s }
end;
|j«i
A
1:
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
1
M o d ifie d
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
-
In s e rt
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
f.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 4 o f 10
O b je c t In s p e c to r
T h e O b je c t In s p e c to r is th e c o n n e c t io n b e tw e e n y o u r a p p lic a tio n 's v is u a l
a p p e a r a n c e a n d th e c o d e th a t m a k e s y o u r a p p lic a tio n ru n .
T h e O b je c t In s p e c to r e n a b le s y o u to :
- s e t d e s ig n - tim e p r o p e r tie s f o r c o m p o n e n t s y o u h a v e p la c e d o n a fo r m (o r
f o r th e fo r m its e lf).
- C r e a te a n d h e lp y o u n a v ig a te th r o u g h e v e n t h a n d le rs .
- F ilt e r v is ib le p r o p e r tie s a n d e v e n ts .
O b je c t In s p e c to r
Fornnl
C
l | Fornnl
T F o rnn l
1
P r o p e r t i e s ' ^ ^ n ts |
A
A c t io n
P ro p e r(je s
|
T F o rnn l
E v e n t P j'''^ )
A c t io n
A lig n
a lN o n e
M enu
A lp h a B le n d
F a ls e
O b je c tM e n u lt e
[ a k L e f t, a k T o p ]
O n C a n F le s iz e
A u to S c ro ll
T ru e
O n C lic k
A u to S iz e
F a ls e
O n C lo s e
B iD iM o d e
b d L e ftT o F iig h t
O n C lo s e Q u e ry
[b iS y s te m M e n u ,
O n C o n s tr a in e d
B o rd e rS tyie
b s S iz e a b le
O n C o n te x tP o p i
B o rd e rW id th
0
O n C r e a te
C a p tio n
IBWTmTI
O n D b lC lic k
C lie n tH e ig h t
217
O n D e a c tiv a te
C lie n tW id th
516
O n D e s tro y
C o lor
O c lB tn F a c e
E l C o n s tra in ts
A
O n A c tiv a te
A lp h a B le n d V a k 2 5 5
E B o r d e r lc o n s
T ||
A c tiv e C o n tr o l
A c tiv e C o n tr o l
E l A n c h o rs
m
O b je c t In s p e c to r
□
O n D o c k D ro p
(T S iz e C o n s tra in v
A ll s h o w n
O nD ockO ver
1
3
I
a
IN t o w ii
T h e O b je c t In s p e c to r h a s tw o p a g e s :
- P r o p e r tie s p a g e
- E v e n ts p a g e
O b je c t In s p e c to r ta b s p r o v id e a m e a n s to s w itc h b e tw e e n th e P r o p e r ty
p a g e a n d th e E v e n t s p a g e o f th e O b je c t In s p e c to r. T o c h a n g e p a g e s , c lic k
th e P r o p e r tie s o r E v e n t s ta b .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 5 o f 10
Y o u c a n d is p la y a n d f ilt e r p r o p e r tie s a n d e v e n ts b y c a te g o r y . B y filte r in g
th e p r o p e r tie s , y o u
can
r e d u c e th e n u m b e r o f p r o p e r tie s v is ib le
in th e
O b je c t In s p e c to r a n d f o c u s o n th o s e w h ic h a r e p r im a r ily o f in te r e s t a t th e
tim e . Y o u c a n a ls o m o r e e a s ily lo c a te r e la te d p r o p e r tie s b y v ie w in g th e m
by
c a te g o r y .
For
e x a m p le ,
w hen
lo c a liz in g
your
a p p lic a tio n
fo r
o th e r
c o u n tr ie s , y o u c a n d is p la y o n ly p r o p e r tie s t h a t n e e d to b e lo c a liz e d
u n c h e c k in g
a ll c a te g o r ie s
except
L o c a liz a b le .
See
P r o p e r ty
and
by
event
c a te g o r ie s in th e O b je c t In s p e c to r.
T h e O b je c t In s p e c to r a ls o in c lu d e s e x p a n d e d in lin e c o m p o n e n t r e fe r e n c e s
th a t d is p la y th e p r o p e r tie s a n d e v e n ts o f a r e fe r e n c e d c o m p o n e n t ( o r a
s u b c o m p o n e n t) w ith o u t h a v in g to a c tu a lly s e le c t th a t c o m p o n e n t.
Y o u c a n c o n tr o l th e c o lo r s in w h ic h ite m s a p p e a r in th e O b je c t In s p e c to r
a n d c h a n g e o p tio n s th a t a llo w y o u to d is p la y a n in s ta n c e list, a s ta tu s b a r,
a n d s h o w r e a d - o n ly p r o p e r tie s . T o c h a n g e th e s e s e ttin g s f o r th e O b je c t
In s p e c to r,
choose
T o o ls |E n v ir o n m e n t
O p tio n s ,
and
c lic k
th e
O b je c t
In s p e c to r ta b o r r ig h t- c lic k th e O b je c t In s p e c to r a n d c h o o s e P ro p e rtie s .
4.
5.
T o o l s a n d M a t e r ia ls
•
P e r s o n a l C o m p u te r
•
W in d o w s X P O p e r a tin g S y s te m
•
B o r la n d D e lp h i 7
W o r k S a fe ty
a.
B e fo r e p r a c tic in g , s tu d e n ts s h o u ld u n d e r s ta n d th e g o a l a n d c o m p e te n c y o f
th is p r a c tic e .
6.
b.
R e a d a n d u n d e r s ta n d a ll p r o c e d u r e s o f t h is p r a c tic e c a r e fu lly .
c.
A lw a y s k e e p d a ta fro m lo s in g c a u s e s b y e x tin g u is h e d e le c tr ic ity .
P ro c e d u re s
6 .1 . C r e a t i n g S im p le P r o g r a m
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r . C lic k m e n u s ta r t - A ll P r o g r a m s B o r la n d D e lp h i 7 - D e lp h i 7.
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
2.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 6 o f 10
ID E D e lp h i w ill lo o k lik e th is :
_
* *
b ft
•
-
a
• Q
F!
C i . #
rrm t 1
t e a r»
la
■
►
j
-
H r
. . J_
II
^
*
Tb »
C M trat
,
~ i |* dal
^
tda±T*4 ! V * % S
^ I ff
« i
A
! * » l i « l r n
J »
M
j
c
?J
t
- •
*
t l*» Car*e f c 1
) ■
•
«
«
r
PC?
s
1
«1
»•»< «■
1 ■
! ■
» { » « :
>W w *
i a
r -« * * L u * *
R a j
i ?
n
m
W
a
M
« * ■
4 «J
C w t n
t»a
**:« *!» *
** * •
D f M r r n
' » •»
fm l
M M M
t *~
r*>
1
U
U
—
-d i l ^ a c a
II
•
N * a «
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
*
-
R e v ie w e d b y :
1
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
3.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 7 o f 10
in th e a c tiv e F o rm , c h o o s e c o m p o n e n t B u tto n 1 o n T a b S ta n d a r d a n d p la c e
it o n fo r m ju s t lik e p ic tu r e b e lo w :
»m k j '
r
U*
k
. J 'f d
# r
r* mrt *i r
k fi»
&
Li
a
J . JL.
►• II
» **
#
IV
’• * «* ■< M M * * * : V f r S l
& H
* i
A “
iM tn w
«I
M
lf M
" • *■;
« *- *»
« « • « •«*. J # ;
I H w -
D * f t «a
* "
tt Jt I t C
>—4 t m
m t t m iili
i?
Baa
■ >B u tto n 1
•M
*«
fM
I C tU l
! 1J »
«'
ft* »*
U n TMM
:» >
Ita
(+ •
10.4*1 J + J I
»»* * • • •
§■
( n »1
V*
Hw'
Allto m
4.
S e t e a c h c o m p o n e n t’s p r o p e r tie s b y s e le c tin g c o m p o n e n t firs t, th e n c h o o s e
p r o p e r tie s o n O b je c t In s p e c to r, w ith th e v a lu e b e lo w .
K om ponen
5.
P r o p e r tie s
V a lu e
F o rm 1
C a p tio n
P r a k tik M e m b u a t P r o g r a m S e d e r h a n a
B u tto n 1
C a p tio n
K lik S a y a !
T h e n th e d e s ig n w ill lo o k lik e th is :
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
S em e ste r 2
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
hours
4 x 5 0 m in s
6.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
F ill p r o g r a m c o d e o f B u tto n 1
P a g e 8 o f 10
in tw o w a y s : a ) d o u b le c lic k o n B u tto n 1 , o r
b ) s e le c t B u tto n 1 , s e le c t E v e n t s o n O b je c t In s p e c to r, th e n d o u b le c lic k ite m
O n C lic k . W r it e th e s e c o d e :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
b e g in
A p p lica tio n .M e s s a g e B o x ('H a lo , Saya baru saja d ik lik ', 'In fo rm a s i', M B_O K o r
M B_IC O N E X C LA M A TIO N );
end;
7.
P r o je c t is r e a d y to ru n in th r e e w a y s : a ) C lic k t o o lb a r
o r b ) v ia m e n u
R u n | R u n , o r c ) p u s h b u tto n F 9 o n k e y b o a r d .
8.
A fte r p ro g ra m
ru n n in g , c lic k o n b u tto n
K lik S a y a !’ , th e n a m e s s a g e b o x
w ill s h o w e d :
9.
S a v e y o u r p r o je c t b y s e le c tin g m e n u F ile | S a v e A ll. D e lp h i w ill s h o w a
d ia lo g b o x a n d a s k in g y o u to in s e r t th e n a m e o f u n it in y o u r fo r m . W r ite
U L a tih a n 1 .p a s a n d c lic k O K . D e lp h i w ill a g a in s h o w d ia lo g b o x a n d a s k in g
y o u to in s e r t th e n a m e o f y o u r p r o je c t. F ill it w ith
PLatihanl.dpr
and
c lic k O K .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
S em e ste r 2
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
C la s s ic a l
hours
4 x 5 0 m in s
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
P a g e 9 o f 10
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 10 o f 10
10 . A lw a y s tr y to s a v e u n it file b e g in w ith le tte r u ________ .pas a n d s a v e
p r o je c t file b e g in w ith
le tte r p ________ .dpr. it is u s e fu l to d is tin g u is h
b e tw e e n u n it file w ith p r o je c t file .
11 . S a v e d p r o je c t w ill c r e a tin g a lo t o f file s , b u t 3 m a in file s a re :
• PLatihanl.dpr, c o n ta in m a in p r o g r a m o f y o u r a p p lic a tio n .
• ULatihan.pas , u n it th a t w ill h a n d le e v e n ts o n fo r m .
• ULatihan.dfm , lis t o f c o m p o n e n t s a n d t h e ir p r o p e r tie s in th e
7.
fo r m ( s ) .
D is c u s s io n
a.
C r e a te
a
b u tto n s
p ro g ra m
w ith
2
b u tto n s .
C hange
p r o p e r ty
C a p tio n
o f th o s e
b e c o m e ‘ B ir u ’ d a n ‘ M e r a h ’ . T h e r e q u e s t a re , ‘ B ir u ’ , th e n fo r m c o lo r
w ill c h a n g e in to b lu e a n d if w e c lic k ‘M e r a h ’ b u tto n , th e n fo r m
c o lo r w ill
c h a n g e in to re d .
R u n n in g p r o g r a m w ill lo o k lik e th is p ic tu re :
b.
P u t th r e e T b u tto n c o m p o n e n t s a n d a T e d it c o m p o n e n t o n a fo r m . W h e n
B u tto n 1
p re s s e d ,
te x t o n
E d it1
B u tto n 2
p r e s s e d , te x t o n E d it1
w ill c h a n g e
w ill c h a n g e
in to
in to
‘P e m ro g ra m a n ’ . W h e n
‘ K o m p u te r ’ . L a s t, w h e n
B u tto n 3 p r e s s e d , te x t o n E d it1 w ill b e e m p ty .
R u n n in g p r o g r a m w ill lo o k lik e th is p ic tu re :
M e ru b a h
[I
B u tto n i
Is i T e k s
;
B u tt o n 2
B u tt o n 3
E d irl
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
S em e ste r 2
D a ta T y p e in P ro g ra m m in g
$
1.
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 1 o f 15
C o m p e te n c y
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e c o m p e te n c ie s : k n o w , u n d e r s ta n d
a n d a p p ly in g D a ta T y p e a n d a p p lic a tio n in P r o g r a m m in g .
2.
S u b C o m p e te n c ie s
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e s u b c o m p e te n c ie s :
3.
a.
K n o w in g p a r ts o f d a ta ty p e .
b.
U n d e r s ta n d f u n c tio n a n d p r o c e d u r e o f d a ta ty p e .
c.
A p p ly in g d a ta ty p e in p r o g r a m m in g .
In t r o d u c t i o n
3 .1 . V a r i a b l e
W e o fte n u s e v a r ia b le s in c o m p u te r p r o g r a m m in g . V a r ia b le s a r e s im p ly a p la c e
to k e e p d a ta .
S y n t a x o f v a r ia b le d e c la r a tio n o n D e lp h i is:
var
nama_ variabel: tipe_ variabel;
e x a m p le :
var
i: in te g e r;
T o d e c la r e s e v e r a l v a r ia b le s w ith d iffe r e n t d a ta ty p e , w e o n ly h a v e to w r ite
k e y w o r d v a r o n c e , lik e th is :
var
i: in te g e r;
j: real;
k: c h a r;
H e r e a n o th e r s a m p le o f s e v e r a l v a r ia b le s w ith s a m e d a ta ty p e s :
var
i, j , k: in te g e r;
a, b, c: c h a r;
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 2 o f 15
V a r ia b le n a m e o n D e lp h i m u s t f o llo w th e s e ru le s :
•
N a m e o f v a r ia b le m a x im u m c o n s is t o f 6 3 c h a r a c te r s . If v a r ia b le h a s m o r e
th a n 6 3 c h a r a c te r s , c o m p ile r w ill a b a n d o n th e r e m a in d e r c h a r a c te r .
•
N a m e o f v a r ia b le c a n o n ly c o n ta in c h a r a c te r s , n u m b e r s , u n d e r s c o r e s , a n d
m u s t n o t b e g in w ith n u m b e r.
•
K e y w o r d o f D e lp h i c a n n o t b e a v a r ia b le n a m e , f o r e x a m p le i f , e l s e , f o r , e tc .
3 .2 .
D a ta T y p e
A ty p e is e s s e n tia lly a n a m e f o r a k in d o f d a ta . W h e n y o u d e c la r e a v a r ia b le
y o u m u s t s p e c ify its ty p e , w h ic h d e te r m in e s th e s e t o f v a lu e s th e v a r ia b le c a n
h o ld a n d th e o p e r a tio n s t h a t c a n b e p e r fo r m e d o n it. E v e r y e x p r e s s io n r e tu r n s
d a ta
of
a
p a r tic u la r
ty p e ,
as
does
e v e ry
fu n c tio n .
M ost
f u n c tio n s
and
p r o c e d u r e s r e q u ir e p a r a m e te r s o f s p e c ific ty p e s . In D e lp h i, it c o n s is ts of:
•
In te g e r d a ta ty p e s .
•
R e a l d a ta ty p e s .
•
B o o le a n d a ta ty p e s .
•
C h a r a c t e r d a ta ty p e s .
•
S tr in g d a ta ty p e s .
a.
In te g e r ty p e s
A n in te g e r ty p e r e p r e s e n ts a s u b s e t o f th e w h o le n u m b e rs . T h e g e n e r ic
in te g e r ty p e s a r e In te g e r a n d C a rd in a l; u s e th e s e w h e n e v e r p o s s ib le , s in c e
th e y r e s u lt in th e b e s t p e r fo r m a n c e f o r th e u n d e r ly in g C P U a n d o p e r a tin g
s y s te m . T h e ta b le b e lo w g iv e s t h e ir r a n g e s a n d s to r a g e f o r m a t s f o r th e
c u r r e n t 3 2 - b it D e lp h i c o m p ile r .
F u n d a m e n ta l in te g e r ty p e s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
B it
Type
R a n g e F o rm a t
S h o r tin t
8 b it
-1 2 8 .. 1 2 7
S m a llin t
1 6 b it
- 3 2 7 6 8 .. 3 2 7 6 7
L o n g in t
3 2 b it
- 2 1 4 7 4 8 3 6 4 8 .. 2 1 4 7 4 8 3 6 4 7
B y te
8 b it
0 .. 2 5 5
W o rd
1 6 b it
0 .. 6 5 5 3 5
C re a ted b y :
S a m su l H ad i
a n d O th ers
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lty o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 3 o f 15
G e n e r ic in te g e r ty p e s f o r 3 2 - b it im p le m e n ta io n s o f D e lp h i
B it
Type
b.
R a n g e F o rm a t
In te g e r ( D e lp h i 1)
1 6 b it
- 3 2 7 6 8 .. 3 2 7 6 7
C a r d in a l ( D e lp h i 1)
1 6 b it
0 .. 6 5 5 3 5
In te g e r ( D e lp h i 2 s /d 7 )
3 2 b it
- 2 1 4 7 4 8 3 6 4 8 .. 2 1 4 7 4 8 3 6 4 7
C a r d in a l ( D e lp h i 2 s /d 7 )
3 2 b it
0 .. 2 1 4 7 4 8 3 6 4 7
R e a l ty p e s
A re a l t y p e d e fin e s a s e t o f n u m b e r s th a t c a n b e r e p r e s e n te d w ith
flo a t in g - p o in t n o ta tio n .
The
ta b le
b e lo w
g iv e s
th e
ra n g e s
and
s to r a g e
o r m a t s f o r th e f u n d a m e n ta l re a l ty p e s .
S iz e in B it
Type
R a n g e F o rm a t
S ig n ific a n t
D ig it
R eal
6 b it
2 .9 * 1 0 -39 .. 1 .7 * 1 0 38
1 1 -1 2
S in g le
D o u b le
4 b it
1 .5 * 1 0 -45 .. 3 . 4 * 1 0 38
7 -8
8 b it
5 .0 * 1 0 -324 .. 1 .7 * 1 0 308
3 4*1 q -4932 ^ 1*1 q 4932
63
63
1 5 -1 6
1 9 -2 0
- 9 2 2 3 3 7 2 0 3 6 8 5 4 7 7 .5 8 0 8
1 9 -2 0
E x te n d e d
1 0 b it
C om p
8 b it
C u rre n c y
8 b it
1 9 -2 0
.. 9 2 2 3 3 7 2 0 3 6 8 5 4 7 7 .5 8 0 7
c.
B o o le a n ty p e s
T h e f o u r p r e d e fin e d B o o le a n ty p e s a r e B o o le a n , B y te B o o l, W o r d B o o l, a n d
L o n g B o o l.
B o o le a n
is th e
p r e fe r r e d
ty p e .
The
o th e r s
e x is t to
p r o v id e
c o m p a tib ility w ith o t h e r la n g u a g e s a n d o p e r a tin g s y s te m lib ra rie s .
A B o o le a n v a r ia b le o c c u p ie s o n e b y te o f m e m o ry , a B y te B o o l v a r ia b le a ls o
o c c u p ie s o n e b y te , a W o r d B o o l v a r ia b le o c c u p ie s tw o b y te s (o n e w o rd ),
a n d a L o n g B o o l v a r ia b le o c c u p ie s f o u r b y te s (tw o w o r d s ) .
B o o le a n v a lu e s a r e d e n o te d b y th e p r e d e fin e d c o n s ta n ts T r u e a n d F a ls e .
T h e fo llo w in g r e la tio n s h ip s h o ld .
D a ta T y p e
M e m o ri n e e d e d
B o o le a n
1 b y te
B y te B o o l
1 b y te
W o rd B o o l
2 b y te (1 w o r d )
LongBool
4 b y te (2 w o r d )
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
d.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 4 o f 15
C h a r a c te r ty p e s
T h e f u n d a m e n ta l c h a r a c te r t y p e s a r e A n s iC h a r a n d W id e C h a r . A n s iC h a r
v a lu e s a r e b y te - s iz e d (8 - b it) c h a r a c te r s o r d e r e d a c c o r d in g to th e lo c a le
c h a r a c te r s e t w h ic h is p o s s ib ly m u ltib y te . A n s iC h a r w a s o r ig in a lly m o d e le d
a f t e r th e A N S I c h a r a c te r s e t ( th u s its n a m e ) b u t h a s n o w b e e n b r o a d e n e d
to r e fe r to th e c u r r e n t lo c a le c h a r a c te r s e t.
W id e C h a r c h a r a c te r s u s e m o r e th a n o n e b y te to r e p r e s e n t e v e r y c h a r a c te r .
In th e c u r r e n t im p le m e n ta tio n s , W id e C h a r is w o r d - s iz e d ( 1 6 - b it) c h a r a c te r s
o r d e r e d a c c o r d in g to th e U n ic o d e c h a r a c te r s e t (n o te t h a t it c o u ld b e lo n g e r
in f u t u r e im p le m e n ta tio n s ) . T h e fir s t 2 5 6 U n ic o d e c h a r a c te r s c o r r e s p o n d to
th e A N S I c h a r a c te r s .
N o te
O n L in u x , w c h a r _ t w id e c h a r is 3 2 b its p e r c h a r a c te r . T h e 1 6 - b it U n ic o d e
s ta n d a r d t h a t D e lp h i W id e C h a r s s u p p o r t is a s u b s e t o f th e 3 2 - b it U C S
s ta n d a r d s u p p o r te d b y L in u x a n d th e G N U lib ra rie s . D e lp h i W id e C h a r d a ta
m u s t b e w id e n e d to 3 2 b its p e r c h a r a c te r b e fo r e it c a n b e p a s s e d to a n O S
fu n c tio n a s w c h a r _ t.
The
g e n e r ic
c h a r a c te r t y p e
is
C h a r,
w h ic h
is e q u iv a le n t to
A n s iC h a r .
B e c a u s e th e im p le m e n ta tio n o f C h a r is s u b je c t to c h a n g e , it's a g o o d id e a
to u s e th e s ta n d a r d fu n c tio n
w h e n w r itin g
S iz e O f r a th e r th a n a h a r d - c o d e d c o n s ta n t
p r o g r a m s t h a t m a y n e e d to h a n d le c h a r a c te r s o f d iffe r e n t
s iz e s .
A s tr in g c o n s ta n t o f le n g th 1, s u c h a s 'A ', c a n d e n o te a c h a r a c te r v a lu e .
T h e p r e d e fin e d f u n c tio n C h r r e tu r n s th e c h a r a c te r v a lu e f o r a n y in te g e r in
th e r a n g e o f A n s iC h a r o r W id e C h a r ; f o r e x a m p le , C h r ( 6 5 ) r e tu r n s th e le tte r
A.
C h a r a c te r
v a lu e s ,
in c r e m e n te d
lik e
p a s t th e
in te g e r s ,
b e g in n in g
w ra p
or end
a ro u n d
w hen
o f t h e ir
ra n g e
d e c r e m e n te d
( u n le s s
ra n g e -
c h e c k in g is e n a b le d ) . F o r e x a m p le , a ft e r e x e c u tio n o f th e c o d e
var
L e tte r: C h a r;
I: In te g e r;
b e g in
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
or
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 5 o f 15
L e tte r := H ig h ( L e tte r ) ;
f o r I := 1 to 6 6 d o
In c ( L e tte r) ;
end;
L e tte r h a s th e v a lu e A (A S C II 6 5 ).
e.
S tr in g ty p e s
A s tr in g r e p r e s e n ts a s e q u e n c e o f c h a r a c te r s . D e lp h i s u p p o r ts th e f o llo w in g
p r e d e fin e d s tr in g ty p e s .
S tr in g ty p e s
T y p e M a x im u m le n g th
S h o r tS tr in g
M e m o r y r e q u ir e d
U se d fo r
2 5 5 c h a r a c te r s
2 to 2 5 6 b y te s
b a c k w a rd
~ 2 A31 c h a r a c te r s
4 b y te s to 2 G B
8 - b it
c o m p a tib ility
A n s iS tr in g
( A N S I)
c h a r a c te r s , D B C S A N S I, M B C S A N S I, e tc .
W id e S tr in g
~ 2 A 3 0 c h a r a c te r s
4 b y te s to 2 G B
U n ic o d e
c h a r a c te r s ;
m u lt i- u s e r s e r v e r s a n d m u lt i- la n g u a g e a p p lic a tio n s
A n s iS tr in g , s o m e tim e s c a lle d th e lo n g s tr in g , is th e p r e fe r r e d ty p e f o r m o s t
p u rp o s e s .
S tr in g ty p e s c a n b e m ix e d in a s s ig n m e n ts a n d e x p r e s s io n s ; th e c o m p ile r
a u t o m a tic a lly
p e r fo r m s
r e q u ir e d
c o n v e r s io n s .
But
s tr in g s
passed
by
r e fe r e n c e to a f u n c tio n o r p r o c e d u r e (a s v a r a n d o u t p a r a m e te r s ) m u s t b e
o f th e a p p r o p r ia te ty p e . S tr in g s c a n b e e x p lic itly c a s t to a d iffe r e n t s trin g
t y p e (s e e T y p e c a s ts ) .
The
re s e rv e d
w o rd
s tr in g
f u n c tio n s
lik e
a
g e n e r ic
ty p e
id e n tifie r .
For
e x a m p le ,
v a r S: s tr in g ;
c r e a te s a v a r ia b le S th a t h o ld s a s tr in g .
c o m p ile r in te r p r e ts s tr in g ( w h e n
In th e d e fa u lt { $ H + } s ta te , th e
it a p p e a r s w ith o u t a b r a c k e te d
num ber
a f t e r it) a s A n s iS tr in g . U s e th e { $ H - } d ir e c tiv e to tu r n s tr in g in to S h o r tS tr in g .
T h e s ta n d a r d f u n c tio n L e n g th r e tu r n s th e n u m b e r o f c h a r a c te r s in a s trin g .
T h e S e tL e n g th p r o c e d u r e a d ju s ts th e le n g th o f a s tr in g .
s tr in g s
is
d e fin e d
b y th e
o r d e r in g
o f th e
c h a r a c te r s
in
C o m p a r is o n o f
c o r r e s p o n d in g
p o s itio n s . B e tw e e n s tr in g s o f u n e q u a l le n g th , e a c h c h a r a c te r in th e lo n g e r
s tr in g w it h o u t a c o r r e s p o n d in g c h a r a c te r in th e s h o r te r s tr in g t a k e s o n a
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 6 o f 15
g r e a te r - th a n v a lu e . F o r e x a m p le , " A B " is g r e a te r th a n "A "; t h a t is, 'A B ' > 'A '
r e tu r n s T ru e . Z e r o - le n g th s tr in g s h o ld th e lo w e s t v a lu e s .
Y o u c a n in d e x a s tr in g v a r ia b le ju s t a s y o u w o u ld a n a r ra y . If S is a s trin g
v a r ia b le a n d i a n in te g e r e x p r e s s io n , S [i] r e p r e s e n ts th e ith c h a r a c te r - - o r ,
s tr ic tly s p e a k in g , th e ith b y te - - in S. F o r a S h o r tS tr in g o r A n s iS tr in g , S [i] is o f
ty p e A n s iC h a r ; f o r a W id e S tr in g , S [i] is o f ty p e W id e C h a r . F o r s in g le - b y t e
( W e s te r n ) lo c a le s , M y S tr in g [2 ] := 'A '; a s s ig n s th e v a lu e A to th e s e c o n d
c h a r a c te r
of
M y S trin g .
The
f o llo w in g
code
uses
th e
s ta n d a r d
A n s iU p p e r C a s e fu n c tio n to c o n v e r t M y S tr in g to u p p e r c a s e .
v a r I: In te g e r;
b e g in
I := L e n g th ( M y S tr in g ) ;
w h ile I > 0 d o
b e g in
M y S tr in g [I] := A n s iU p p e r C a s e ( M y S tr in g [I]) ;
I := I - 1;
end;
end;
B e c a r e fu l in d e x in g s tr in g s in th is w a y , s in c e o v e r w r itin g th e e n d o f a s tr in g
c a n c a u s e a c c e s s v io la tio n s . A ls o , a v o id p a s s in g lo n g - s tr in g in d e x e s a s v a r
p a r a m e te r s , b e c a u s e th is r e s u lts in in e ffic ie n t c o d e .
Y o u c a n a s s ig n th e v a lu e o f a s tr in g c o n s t a n t - - o r a n y o t h e r e x p r e s s io n th a t
r e tu r n s a s tr in g - - t o a v a r ia b le . T h e le n g th o f th e s tr in g c h a n g e s d y n a m ic a lly
w h e n th e a s s ig n m e n t is m a d e . E x a m p le s :
M y S tr in g := 'H e llo w o r ld !';
M y S tr in g := 'H e llo ' + 'w o rld ';
M y S tr in g := M y S tr in g + '!';
M y S tr in g := ' ';
{ space }
M y S tr in g := '';
{ e m p ty s tr in g }
3 .3 . C o n s t a n t s
S e v e r a l d iffe r e n t la n g u a g e c o n s tr u c t io n s a r e r e fe r r e d to a s " c o n s ta n ts " . T h e r e
a r e n u m e r ic c o n s ta n ts ( a ls o c a lle d n u m e r a ls ) lik e
( a ls o
c a lle d
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
c h a r a c te r
s tr in g s
or
s tr in g
lite r a ls )
17 , a n d s tr in g c o n s ta n ts
lik e
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
'H e llo
w o r ld !'.
E v e ry
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
e n u m e r a te d
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
ty p e d e fin e s
P a g e 7 o f 15
c o n s ta n ts th a t r e p r e s e n t th e v a lu e s o f t h a t ty p e .
T h e r e a r e p r e d e fin e d c o n s ta n ts lik e T r u e ,
F a ls e , a n d n il. F in a lly , t h e r e a re
c o n s ta n ts th a t, lik e v a r ia b le s , a r e c r e a te d in d iv id u a lly b y d e c la r a tio n .
D e c la r e d c o n s ta n ts a r e e ith e r tr u e c o n s ta n ts o r ty p e d c o n s ta n ts . T h e s e tw o
k in d s o f c o n s ta n t a r e s u p e r fic ia lly s im ila r , b u t th e y a r e g o v e r n e d b y d iffe r e n t
ru le s a n d u s e d f o r d iffe r e n t p u rp o s e s .
P e n d e k la r a s ia n k o n s ta n ta d ila k u k a n d e n g a n s in ta k s b e rik u t:
const
nameof_konstanta = valueof_konstantam
,
e x a m p le :
const
M aksim um
= 10;
Log N a tu ra l
Bahasa
= 2 .7 1 8 2 8 1 8 2 8 ;
= 'O b je c t Pascal';
W e c o u ld d e te r m in e th e ty p e o f c o n s ta n t. It c a lle d ty p e d c o n s ta n ta .
e x a m p le :
const
M aksim um
: in te g e r = 10;
Log N a tu ra l
Bahasa
4.
5.
: d o u b le = 2 .7 1 8 2 8 1 8 2 8 ;
: S h o rtS trin g = 'O b je c t Pascal';
T o o l s a n d M a t e r ia ls
•
P e r s o n a l C o m p u te r
•
W in d o w s X P O p e r a tin g S y s te m
•
B o r la n d D e lp h i 7
W o r k S a fe ty
a.
B e fo r e p r a c tic in g , s tu d e n ts s h o u ld u n d e r s ta n d th e g o a l a n d c o m p e te n c y o f
th is p r a c tic e .
6.
b.
R e a d a n d u n d e r s ta n d a ll p r o c e d u r e s o f th is p r a c tic e c a r e fu lly .
c.
A lw a y s k e e p d a ta fro m lo s in g c a u s e s b y e x tin g u is h e d e le c tr ic ity .
P ro c e d u re s
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 8 o f 15
6 .1 . P r a k t i k P e n g g u n a a n T i p e B i la n g a n B u la t
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
In a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
U* tart r»—< *ir
**
•
O
la
# p ■
j .
►- a
x
'w ***?■
#
M
tM
M
t 'M
v l lM
w«m
k w
M
*J
U
M
I M
a 4
r
« n
D M w
W
1 4 «
J?
Label
LabeL
Label
L a b e l4 <
• I M
M
fmm
llt a k a
Ubf io ffl
t»«
M > i*»
)| M
I t t U i
UH *T _i*o «
Dl v J n m
l . t eVi t t
Cv » .
Lf cMf A' U»
r *>
-c
^ / » 4 i »u
1
l w»1
w
|l •«*. -— m »- •
• Jt V—
3.
S e t th e p r o p e r tie s o f e a c h c o m p o n e n t s a s fo llo w :
C om ponent
P r o p e r tie s
F o rm l
C a p tio n
T ip e B ila n g a n B u la t
L a b e ll
C a p tio n
x =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
y =
12
L a b e l2
F o n t - S iz e
L a b e l3
L a b e ll
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
V a lu e
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
x + y =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
x * y =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
S em e ste r 2
D a ta T y p e in P ro g ra m m in g
$
hours
4 x 5 0 m in s
4.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
E d it1
Text
E d it2
Text
E d it3
Text
E d it4
Text
B u tto n 1
C a p tio n
H itu n g
P a g e 9 o f 15
T h e r e s u lt is lik e p ic tu r e b e lo w :
x =:
H itu n g
x + y =
::x * y = [
5.
D o u b le C lic k o n B u tto n 1 , th e n w r ite c o d e p r o g r a m a s fo llo w :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
var
x , y , z: in te g e r;
b e g in
x := S trT o In t(E d it1 .T e x t);
y := S trT o In t(E d it2 .T e x t);
z := x + y ;
E d it3 .T e x t := In tT o S tr( z );
z := x * y ;
E d it4 .T e x t := In tT o S tr( z );
end;
6.
R u n p r o je c t b y c lic k in g t o o lb a r
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
.
iJ
o r p re s s F 9 on y o u r k e y b o a rd .
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
7.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 10 o f 15
A f t e r p r o g r a m ru n n in g , e n tr y th e n u m b e r 3 a n d 4 s e q u e n tia lly o n E d it1 a n d
E d it2 , th e n c lic k b u tto n H itu n g . W e c a n s e e t h a t o n E d it3 w ill s h o w r e s u lt
3 + 4 = 7 a n d o n E d it4 w ill s h o w r e s u lt 3 * 4 = 1 2 lik e p ic tu r e b e lo w :
7
1 i|> c
4
H i l d n g d n
=
|3
y =
I4
X
| l'
m
H u l d l
i litLinq
im
p e l
'|
x ■ y = k
x * y
|iz
8.
T r y to e n tr y a n o t h e r n u m b e r o n E d it1 d a n E d it2 ju s t lik e s te p 7.
9.
S a v e y o u r p r o je c t a s T ip e D a t a 1 .
6 .2 . A p p l y i n g R e a l T y p e o n P r o g r a m m in g
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
n a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
----
►
M l
m
_ #
.
C
■
(B U
m
■ M l*
►
*
»
4 *
i
.
'• * » •
w
*
illlt M *
t
« W O .; I ■ ■
A
f y
« j
3
t e U
JSJ
*
•
I fi
M
t f
K
^
w
•»“ * *
*•
u
C « £ m
"
M
i£ > :
n a -M
I m
»
i Z m m O m
! 2«fcJ
£
Labe
Labe
Labe
Labe
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
3.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 11 o f 15
S e t th e p r o p e r tie s o f e a c h c o m p o n e n t s a s fo llo w :
C om ponent
P r o p e r tie s
V a lu e
F o rm 1
C a p tio n
T ip e B ila n g a n R e a l
L a b e l1
C a p tio n
M e n c a r i L u a s d a n K e lilin g
L in g k a r a n
4.
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
L a b e l2
C a p tio n
M a s u k k a n n ila i ja r i- ja r i
L a b e l3
C a p tio n
L u a s lin g k a r a n =
L a b e l4
C a p tio n
K e lilin g lin g k a r a n =
E d it1
Text
E d it2
Text
E d it3
Text
B u tto n 1
C a p tio n
H itu n g
T h e r e s u lt is lik e p ic tu r e b e lo w :
M e n c a r i L u a s d a n K e lilin g L in g k a r a n
M a s u k k a n n ilai jari-jari- • P
H itun g
L u a s lin g k a ra n =
K eliling lin g k a ra n -
5.
D o u b le C lic k o n B u tto n 1 , th e n w r ite c o d e p r o g r a m a s fo llo w :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
var
ja ri_ ja ri: re a l;
lu a s _ lin g k a ra n : re a l;
k e lilin g jin g k a r a n : re a l;
const
phi = 3 .1 4 ;
b e g in
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 12 o f 15
ja ri_ ja ri := S trT o F lo a t(E d it1 .T e x t);
lu a s_ lin g ka ra n := 2 * phi * ja ri_ ja ri;
E d it2 .T e x t := F lo a tT o S tr(lu a s _ lin g k a ra n );
k e lilin g _ lin g k a ra n := phi * ja ri_ ja ri * ja ri_ ja ri;
E d it3 .T e x t := F lo a tT o S tr(k e lilin g _ lin g k a ra n );
end;
6.
7.
R u n p r o je c t b y c lic k in g t o o lb a r
A fte r p ro g ra m
o r p re s s F 9 on y o u r k e y b o a rd .
ru n n in g , e n tr y th e n u m b e r 5 o n E d it1 , c lic k b u tto n H itu n g ,
th e n E d it2 w ill s h o w c ir c le v a s t a s 3 1 ,4 a n d E d it3 w ill s h o w c ir c le a r o u n d
e q u a l to 7 8 ,5 lik e s h o w n b e lo w :
7 ' T ip e B ila n g a n R e a l
K
U
j
I
M e n c a r i L u a s d a n K e lilin g L in g k a r a n
M a s u k k a n r i a i jari-jari
F ~
1
!
H itu n g
!
1
L u a s lin g k a ra n =
13 1 .4
K eliling lin g k a ra n =
|7 8 .5
8.
T r y to e n tr y a n o t h e r n u m b e r o n E d it1 d a n E d it2 ju s t lik e s te p 7.
9.
S a v e y o u r p r o je c t a s T ip e D a ta 2 .
6 .3 . A p p ly in g
B o o le a n T y p e o n P r o g r a m m in g
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
In a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
t * n |» '
**
*
.’S
&• (4 It
J r
P»«Ht «O' 'M tn n
i , J, +
^ - i
b
! / ! '« *
■*! Si‘
.
-1+1’
'K *
in n
IW ta m 0«toLv*Q*l M om r
a «
*j
“
P a g e 13 o f 15
«1
DOfc 1
“=
»l««n
1
mm*lmw- >*11* wM m
D«*eLi*e t»#-1--*
U
7
f* fo < «
u fi * *
3 »
3 1 *» '
■ 691
________
- r
Edit1
—
— ------------------------------------------------------
(||M W HIW
► B utton1
•
— a
•M
'*»•
OV.M
ic m
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
1.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 1 o f 10
C o m p e te n c y
A fte r
p r a c tic in g ,
s tu d e n ts
w ill
have
c o m p e te n c ie s :
k n o w in g ,
u n d e r s ta n d in g a n d a p p ly in g I D E ( In te g r a te d D e v e lo p m e n t E n v ir o n m e n t) D e lp h i
in c o m p u te r p r o g r a m m in g .
2.
S u b C o m p e t e n c ie s
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e s u b c o m p e te n c ie s :
a.
3.
K n o w in g p a r ts o f ID E D e lp h i.
b.
U n d e r s ta n d f u n c tio n a n d p r o c e d u r e o f e a c h p a r t o f ID E D e lp h i.
c.
A p p ly in g ID E D e lp h i to m a k e a s im p le p r o g r a m .
In t r o d u c t i o n
3 .1 . K n o w in g ID E D e lp h i
ID E D e lp h i c o n s is ts o f 6 m a in p a rts , w h ic h a re : M e n u , S p e e d B a r, C o m p o n e n t
P a le tte , F o rm D e s ig n e r, C o d e E d ito r a n d O b je c t In s p e c to r.
Speed Bar
O b je c t In s p e c to r
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
M enu
C o d e E d ito r
C o m p o n e n t P a lette
F o rm D e s ig n e r
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
a.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 2 o f 10
M a in M e n u
D e lp h i M a in M e n u h a v e s im ila r f u n c tio n
m e m ilik i k e g u n a a n s e p e r ti
m e n u p a d a a p lik a s i W in d o w s la in n y a . F ro m th is m e n u , y o u c a n o p e n
o r s a v e a p ro g ra m ,
r u n n in g a n d s e a r c h in g
p r o g r a m , e tc .
S h o rtly ,
e v e r y th in g th a t c o n n e c te d w ith I D E D e lp h i c a n b e c a lle d v ia m a in
m enu.
F ile
b.
E d it
S e a rc h
V ie w
P r o je c t
R un
C om ponent
D a ta b a s e
T o o ls
W in d o w
H e lp
Speed B ar
S p e e d B a r o r t o o lb a r c o n ta in s e t o f b u tto n th a t h a v e s a m e fu n c tio n w ith
m o s tly ite m m e n u .
c.
C o m p o n e n t P a le tt e
C o m p o n e n t P a le tt e c o n ta in s s e t o f ic o n th a t r e p r e s e n ts c o m p o n e n t s o f
VCL
(Visual Component Library). V C L is c o m p o n e n t t h a t c a n b e u s e d to
b u ild a n a p p lic a tio n .
S ta n d a rd
d.
A d d it io n a l
W i n 3 2 ] S y s te m
D a ta A c c e s s
D a ta C o n tro ls ] d b E x o r e s s ] D a ta S n a o
BDE
^ I *
F o rm D e s ig n e r
F o rm
D e s ig n e r is a p la c e to d e s ig n w in d o w s a p p lic a tio n . T h e D e s ig n is
p la c e m e n t o f c o m p o n e n t s fr o m C o m p o n e n t P a le tte .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
2k
e.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 3 o f 10
HD®
F o rm i
C o d e E d ito r
C o d e E d ito r is p la c e to w r ite p r o g r a m in P a s c a l L a n g u a g e . C o d e e d ito r h a s
a C o d e In s p e c to r, s o th a t w e d o n ’t h a v e to w r ite w h o le in s tr u c tio n . D e lp h i
h a s w r ite a b a s ic s tr u c tu r e o f a p r o g r a m . L o o k a t th e p ic tu r e b e lo w :
§3 U n it 1. pas
U n it l
►j
T F o rm l
+
_ l
V a r ia b le s /C o n s ta n ts
+
__ | U s e s
'
T
unit Unitl;
A
interface
uses
Windows, Messages, SysUtils, Variants,
Dialogs;
type
TForml = class(TForm)
private
{ P riva te d eclarations }
public
{ Public d ec la ra tio n s }
end;
|j«i
A
1:
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
1
M o d ifie d
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
-
In s e rt
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
f.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 4 o f 10
O b je c t In s p e c to r
T h e O b je c t In s p e c to r is th e c o n n e c t io n b e tw e e n y o u r a p p lic a tio n 's v is u a l
a p p e a r a n c e a n d th e c o d e th a t m a k e s y o u r a p p lic a tio n ru n .
T h e O b je c t In s p e c to r e n a b le s y o u to :
- s e t d e s ig n - tim e p r o p e r tie s f o r c o m p o n e n t s y o u h a v e p la c e d o n a fo r m (o r
f o r th e fo r m its e lf).
- C r e a te a n d h e lp y o u n a v ig a te th r o u g h e v e n t h a n d le rs .
- F ilt e r v is ib le p r o p e r tie s a n d e v e n ts .
O b je c t In s p e c to r
Fornnl
C
l | Fornnl
T F o rnn l
1
P r o p e r t i e s ' ^ ^ n ts |
A
A c t io n
P ro p e r(je s
|
T F o rnn l
E v e n t P j'''^ )
A c t io n
A lig n
a lN o n e
M enu
A lp h a B le n d
F a ls e
O b je c tM e n u lt e
[ a k L e f t, a k T o p ]
O n C a n F le s iz e
A u to S c ro ll
T ru e
O n C lic k
A u to S iz e
F a ls e
O n C lo s e
B iD iM o d e
b d L e ftT o F iig h t
O n C lo s e Q u e ry
[b iS y s te m M e n u ,
O n C o n s tr a in e d
B o rd e rS tyie
b s S iz e a b le
O n C o n te x tP o p i
B o rd e rW id th
0
O n C r e a te
C a p tio n
IBWTmTI
O n D b lC lic k
C lie n tH e ig h t
217
O n D e a c tiv a te
C lie n tW id th
516
O n D e s tro y
C o lor
O c lB tn F a c e
E l C o n s tra in ts
A
O n A c tiv a te
A lp h a B le n d V a k 2 5 5
E B o r d e r lc o n s
T ||
A c tiv e C o n tr o l
A c tiv e C o n tr o l
E l A n c h o rs
m
O b je c t In s p e c to r
□
O n D o c k D ro p
(T S iz e C o n s tra in v
A ll s h o w n
O nD ockO ver
1
3
I
a
IN t o w ii
T h e O b je c t In s p e c to r h a s tw o p a g e s :
- P r o p e r tie s p a g e
- E v e n ts p a g e
O b je c t In s p e c to r ta b s p r o v id e a m e a n s to s w itc h b e tw e e n th e P r o p e r ty
p a g e a n d th e E v e n t s p a g e o f th e O b je c t In s p e c to r. T o c h a n g e p a g e s , c lic k
th e P r o p e r tie s o r E v e n t s ta b .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 5 o f 10
Y o u c a n d is p la y a n d f ilt e r p r o p e r tie s a n d e v e n ts b y c a te g o r y . B y filte r in g
th e p r o p e r tie s , y o u
can
r e d u c e th e n u m b e r o f p r o p e r tie s v is ib le
in th e
O b je c t In s p e c to r a n d f o c u s o n th o s e w h ic h a r e p r im a r ily o f in te r e s t a t th e
tim e . Y o u c a n a ls o m o r e e a s ily lo c a te r e la te d p r o p e r tie s b y v ie w in g th e m
by
c a te g o r y .
For
e x a m p le ,
w hen
lo c a liz in g
your
a p p lic a tio n
fo r
o th e r
c o u n tr ie s , y o u c a n d is p la y o n ly p r o p e r tie s t h a t n e e d to b e lo c a liz e d
u n c h e c k in g
a ll c a te g o r ie s
except
L o c a liz a b le .
See
P r o p e r ty
and
by
event
c a te g o r ie s in th e O b je c t In s p e c to r.
T h e O b je c t In s p e c to r a ls o in c lu d e s e x p a n d e d in lin e c o m p o n e n t r e fe r e n c e s
th a t d is p la y th e p r o p e r tie s a n d e v e n ts o f a r e fe r e n c e d c o m p o n e n t ( o r a
s u b c o m p o n e n t) w ith o u t h a v in g to a c tu a lly s e le c t th a t c o m p o n e n t.
Y o u c a n c o n tr o l th e c o lo r s in w h ic h ite m s a p p e a r in th e O b je c t In s p e c to r
a n d c h a n g e o p tio n s th a t a llo w y o u to d is p la y a n in s ta n c e list, a s ta tu s b a r,
a n d s h o w r e a d - o n ly p r o p e r tie s . T o c h a n g e th e s e s e ttin g s f o r th e O b je c t
In s p e c to r,
choose
T o o ls |E n v ir o n m e n t
O p tio n s ,
and
c lic k
th e
O b je c t
In s p e c to r ta b o r r ig h t- c lic k th e O b je c t In s p e c to r a n d c h o o s e P ro p e rtie s .
4.
5.
T o o l s a n d M a t e r ia ls
•
P e r s o n a l C o m p u te r
•
W in d o w s X P O p e r a tin g S y s te m
•
B o r la n d D e lp h i 7
W o r k S a fe ty
a.
B e fo r e p r a c tic in g , s tu d e n ts s h o u ld u n d e r s ta n d th e g o a l a n d c o m p e te n c y o f
th is p r a c tic e .
6.
b.
R e a d a n d u n d e r s ta n d a ll p r o c e d u r e s o f t h is p r a c tic e c a r e fu lly .
c.
A lw a y s k e e p d a ta fro m lo s in g c a u s e s b y e x tin g u is h e d e le c tr ic ity .
P ro c e d u re s
6 .1 . C r e a t i n g S im p le P r o g r a m
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r . C lic k m e n u s ta r t - A ll P r o g r a m s B o r la n d D e lp h i 7 - D e lp h i 7.
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
2.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 6 o f 10
ID E D e lp h i w ill lo o k lik e th is :
_
* *
b ft
•
-
a
• Q
F!
C i . #
rrm t 1
t e a r»
la
■
►
j
-
H r
. . J_
II
^
*
Tb »
C M trat
,
~ i |* dal
^
tda±T*4 ! V * % S
^ I ff
« i
A
! * » l i « l r n
J »
M
j
c
?J
t
- •
*
t l*» Car*e f c 1
) ■
•
«
«
r
PC?
s
1
«1
»•»< «■
1 ■
! ■
» { » « :
>W w *
i a
r -« * * L u * *
R a j
i ?
n
m
W
a
M
« * ■
4 «J
C w t n
t»a
**:« *!» *
** * •
D f M r r n
' » •»
fm l
M M M
t *~
r*>
1
U
U
—
-d i l ^ a c a
II
•
N * a «
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
*
-
R e v ie w e d b y :
1
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
3.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 7 o f 10
in th e a c tiv e F o rm , c h o o s e c o m p o n e n t B u tto n 1 o n T a b S ta n d a r d a n d p la c e
it o n fo r m ju s t lik e p ic tu r e b e lo w :
»m k j '
r
U*
k
. J 'f d
# r
r* mrt *i r
k fi»
&
Li
a
J . JL.
►• II
» **
#
IV
’• * «* ■< M M * * * : V f r S l
& H
* i
A “
iM tn w
«I
M
lf M
" • *■;
« *- *»
« « • « •«*. J # ;
I H w -
D * f t «a
* "
tt Jt I t C
>—4 t m
m t t m iili
i?
Baa
■ >B u tto n 1
•M
*«
fM
I C tU l
! 1J »
«'
ft* »*
U n TMM
:» >
Ita
(+ •
10.4*1 J + J I
»»* * • • •
§■
( n »1
V*
Hw'
Allto m
4.
S e t e a c h c o m p o n e n t’s p r o p e r tie s b y s e le c tin g c o m p o n e n t firs t, th e n c h o o s e
p r o p e r tie s o n O b je c t In s p e c to r, w ith th e v a lu e b e lo w .
K om ponen
5.
P r o p e r tie s
V a lu e
F o rm 1
C a p tio n
P r a k tik M e m b u a t P r o g r a m S e d e r h a n a
B u tto n 1
C a p tio n
K lik S a y a !
T h e n th e d e s ig n w ill lo o k lik e th is :
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
S em e ste r 2
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
hours
4 x 5 0 m in s
6.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
F ill p r o g r a m c o d e o f B u tto n 1
P a g e 8 o f 10
in tw o w a y s : a ) d o u b le c lic k o n B u tto n 1 , o r
b ) s e le c t B u tto n 1 , s e le c t E v e n t s o n O b je c t In s p e c to r, th e n d o u b le c lic k ite m
O n C lic k . W r it e th e s e c o d e :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
b e g in
A p p lica tio n .M e s s a g e B o x ('H a lo , Saya baru saja d ik lik ', 'In fo rm a s i', M B_O K o r
M B_IC O N E X C LA M A TIO N );
end;
7.
P r o je c t is r e a d y to ru n in th r e e w a y s : a ) C lic k t o o lb a r
o r b ) v ia m e n u
R u n | R u n , o r c ) p u s h b u tto n F 9 o n k e y b o a r d .
8.
A fte r p ro g ra m
ru n n in g , c lic k o n b u tto n
K lik S a y a !’ , th e n a m e s s a g e b o x
w ill s h o w e d :
9.
S a v e y o u r p r o je c t b y s e le c tin g m e n u F ile | S a v e A ll. D e lp h i w ill s h o w a
d ia lo g b o x a n d a s k in g y o u to in s e r t th e n a m e o f u n it in y o u r fo r m . W r ite
U L a tih a n 1 .p a s a n d c lic k O K . D e lp h i w ill a g a in s h o w d ia lo g b o x a n d a s k in g
y o u to in s e r t th e n a m e o f y o u r p r o je c t. F ill it w ith
PLatihanl.dpr
and
c lic k O K .
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
S em e ste r 2
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
C la s s ic a l
hours
4 x 5 0 m in s
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
P a g e 9 o f 10
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
U n d e rsta n d ID E D e lp h i
and P ro g ra m A lg o rith m
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 10 o f 10
10 . A lw a y s tr y to s a v e u n it file b e g in w ith le tte r u ________ .pas a n d s a v e
p r o je c t file b e g in w ith
le tte r p ________ .dpr. it is u s e fu l to d is tin g u is h
b e tw e e n u n it file w ith p r o je c t file .
11 . S a v e d p r o je c t w ill c r e a tin g a lo t o f file s , b u t 3 m a in file s a re :
• PLatihanl.dpr, c o n ta in m a in p r o g r a m o f y o u r a p p lic a tio n .
• ULatihan.pas , u n it th a t w ill h a n d le e v e n ts o n fo r m .
• ULatihan.dfm , lis t o f c o m p o n e n t s a n d t h e ir p r o p e r tie s in th e
7.
fo r m ( s ) .
D is c u s s io n
a.
C r e a te
a
b u tto n s
p ro g ra m
w ith
2
b u tto n s .
C hange
p r o p e r ty
C a p tio n
o f th o s e
b e c o m e ‘ B ir u ’ d a n ‘ M e r a h ’ . T h e r e q u e s t a re , ‘ B ir u ’ , th e n fo r m c o lo r
w ill c h a n g e in to b lu e a n d if w e c lic k ‘M e r a h ’ b u tto n , th e n fo r m
c o lo r w ill
c h a n g e in to re d .
R u n n in g p r o g r a m w ill lo o k lik e th is p ic tu re :
b.
P u t th r e e T b u tto n c o m p o n e n t s a n d a T e d it c o m p o n e n t o n a fo r m . W h e n
B u tto n 1
p re s s e d ,
te x t o n
E d it1
B u tto n 2
p r e s s e d , te x t o n E d it1
w ill c h a n g e
w ill c h a n g e
in to
in to
‘P e m ro g ra m a n ’ . W h e n
‘ K o m p u te r ’ . L a s t, w h e n
B u tto n 3 p r e s s e d , te x t o n E d it1 w ill b e e m p ty .
R u n n in g p r o g r a m w ill lo o k lik e th is p ic tu re :
M e ru b a h
[I
B u tto n i
Is i T e k s
;
B u tt o n 2
B u tt o n 3
E d irl
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
S em e ste r 2
D a ta T y p e in P ro g ra m m in g
$
1.
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 1 o f 15
C o m p e te n c y
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e c o m p e te n c ie s : k n o w , u n d e r s ta n d
a n d a p p ly in g D a ta T y p e a n d a p p lic a tio n in P r o g r a m m in g .
2.
S u b C o m p e te n c ie s
A f t e r p r a c tic in g , s tu d e n ts w ill h a v e s u b c o m p e te n c ie s :
3.
a.
K n o w in g p a r ts o f d a ta ty p e .
b.
U n d e r s ta n d f u n c tio n a n d p r o c e d u r e o f d a ta ty p e .
c.
A p p ly in g d a ta ty p e in p r o g r a m m in g .
In t r o d u c t i o n
3 .1 . V a r i a b l e
W e o fte n u s e v a r ia b le s in c o m p u te r p r o g r a m m in g . V a r ia b le s a r e s im p ly a p la c e
to k e e p d a ta .
S y n t a x o f v a r ia b le d e c la r a tio n o n D e lp h i is:
var
nama_ variabel: tipe_ variabel;
e x a m p le :
var
i: in te g e r;
T o d e c la r e s e v e r a l v a r ia b le s w ith d iffe r e n t d a ta ty p e , w e o n ly h a v e to w r ite
k e y w o r d v a r o n c e , lik e th is :
var
i: in te g e r;
j: real;
k: c h a r;
H e r e a n o th e r s a m p le o f s e v e r a l v a r ia b le s w ith s a m e d a ta ty p e s :
var
i, j , k: in te g e r;
a, b, c: c h a r;
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 2 o f 15
V a r ia b le n a m e o n D e lp h i m u s t f o llo w th e s e ru le s :
•
N a m e o f v a r ia b le m a x im u m c o n s is t o f 6 3 c h a r a c te r s . If v a r ia b le h a s m o r e
th a n 6 3 c h a r a c te r s , c o m p ile r w ill a b a n d o n th e r e m a in d e r c h a r a c te r .
•
N a m e o f v a r ia b le c a n o n ly c o n ta in c h a r a c te r s , n u m b e r s , u n d e r s c o r e s , a n d
m u s t n o t b e g in w ith n u m b e r.
•
K e y w o r d o f D e lp h i c a n n o t b e a v a r ia b le n a m e , f o r e x a m p le i f , e l s e , f o r , e tc .
3 .2 .
D a ta T y p e
A ty p e is e s s e n tia lly a n a m e f o r a k in d o f d a ta . W h e n y o u d e c la r e a v a r ia b le
y o u m u s t s p e c ify its ty p e , w h ic h d e te r m in e s th e s e t o f v a lu e s th e v a r ia b le c a n
h o ld a n d th e o p e r a tio n s t h a t c a n b e p e r fo r m e d o n it. E v e r y e x p r e s s io n r e tu r n s
d a ta
of
a
p a r tic u la r
ty p e ,
as
does
e v e ry
fu n c tio n .
M ost
f u n c tio n s
and
p r o c e d u r e s r e q u ir e p a r a m e te r s o f s p e c ific ty p e s . In D e lp h i, it c o n s is ts of:
•
In te g e r d a ta ty p e s .
•
R e a l d a ta ty p e s .
•
B o o le a n d a ta ty p e s .
•
C h a r a c t e r d a ta ty p e s .
•
S tr in g d a ta ty p e s .
a.
In te g e r ty p e s
A n in te g e r ty p e r e p r e s e n ts a s u b s e t o f th e w h o le n u m b e rs . T h e g e n e r ic
in te g e r ty p e s a r e In te g e r a n d C a rd in a l; u s e th e s e w h e n e v e r p o s s ib le , s in c e
th e y r e s u lt in th e b e s t p e r fo r m a n c e f o r th e u n d e r ly in g C P U a n d o p e r a tin g
s y s te m . T h e ta b le b e lo w g iv e s t h e ir r a n g e s a n d s to r a g e f o r m a t s f o r th e
c u r r e n t 3 2 - b it D e lp h i c o m p ile r .
F u n d a m e n ta l in te g e r ty p e s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
B it
Type
R a n g e F o rm a t
S h o r tin t
8 b it
-1 2 8 .. 1 2 7
S m a llin t
1 6 b it
- 3 2 7 6 8 .. 3 2 7 6 7
L o n g in t
3 2 b it
- 2 1 4 7 4 8 3 6 4 8 .. 2 1 4 7 4 8 3 6 4 7
B y te
8 b it
0 .. 2 5 5
W o rd
1 6 b it
0 .. 6 5 5 3 5
C re a ted b y :
S a m su l H ad i
a n d O th ers
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lty o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 3 o f 15
G e n e r ic in te g e r ty p e s f o r 3 2 - b it im p le m e n ta io n s o f D e lp h i
B it
Type
b.
R a n g e F o rm a t
In te g e r ( D e lp h i 1)
1 6 b it
- 3 2 7 6 8 .. 3 2 7 6 7
C a r d in a l ( D e lp h i 1)
1 6 b it
0 .. 6 5 5 3 5
In te g e r ( D e lp h i 2 s /d 7 )
3 2 b it
- 2 1 4 7 4 8 3 6 4 8 .. 2 1 4 7 4 8 3 6 4 7
C a r d in a l ( D e lp h i 2 s /d 7 )
3 2 b it
0 .. 2 1 4 7 4 8 3 6 4 7
R e a l ty p e s
A re a l t y p e d e fin e s a s e t o f n u m b e r s th a t c a n b e r e p r e s e n te d w ith
flo a t in g - p o in t n o ta tio n .
The
ta b le
b e lo w
g iv e s
th e
ra n g e s
and
s to r a g e
o r m a t s f o r th e f u n d a m e n ta l re a l ty p e s .
S iz e in B it
Type
R a n g e F o rm a t
S ig n ific a n t
D ig it
R eal
6 b it
2 .9 * 1 0 -39 .. 1 .7 * 1 0 38
1 1 -1 2
S in g le
D o u b le
4 b it
1 .5 * 1 0 -45 .. 3 . 4 * 1 0 38
7 -8
8 b it
5 .0 * 1 0 -324 .. 1 .7 * 1 0 308
3 4*1 q -4932 ^ 1*1 q 4932
63
63
1 5 -1 6
1 9 -2 0
- 9 2 2 3 3 7 2 0 3 6 8 5 4 7 7 .5 8 0 8
1 9 -2 0
E x te n d e d
1 0 b it
C om p
8 b it
C u rre n c y
8 b it
1 9 -2 0
.. 9 2 2 3 3 7 2 0 3 6 8 5 4 7 7 .5 8 0 7
c.
B o o le a n ty p e s
T h e f o u r p r e d e fin e d B o o le a n ty p e s a r e B o o le a n , B y te B o o l, W o r d B o o l, a n d
L o n g B o o l.
B o o le a n
is th e
p r e fe r r e d
ty p e .
The
o th e r s
e x is t to
p r o v id e
c o m p a tib ility w ith o t h e r la n g u a g e s a n d o p e r a tin g s y s te m lib ra rie s .
A B o o le a n v a r ia b le o c c u p ie s o n e b y te o f m e m o ry , a B y te B o o l v a r ia b le a ls o
o c c u p ie s o n e b y te , a W o r d B o o l v a r ia b le o c c u p ie s tw o b y te s (o n e w o rd ),
a n d a L o n g B o o l v a r ia b le o c c u p ie s f o u r b y te s (tw o w o r d s ) .
B o o le a n v a lu e s a r e d e n o te d b y th e p r e d e fin e d c o n s ta n ts T r u e a n d F a ls e .
T h e fo llo w in g r e la tio n s h ip s h o ld .
D a ta T y p e
M e m o ri n e e d e d
B o o le a n
1 b y te
B y te B o o l
1 b y te
W o rd B o o l
2 b y te (1 w o r d )
LongBool
4 b y te (2 w o r d )
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
d.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 4 o f 15
C h a r a c te r ty p e s
T h e f u n d a m e n ta l c h a r a c te r t y p e s a r e A n s iC h a r a n d W id e C h a r . A n s iC h a r
v a lu e s a r e b y te - s iz e d (8 - b it) c h a r a c te r s o r d e r e d a c c o r d in g to th e lo c a le
c h a r a c te r s e t w h ic h is p o s s ib ly m u ltib y te . A n s iC h a r w a s o r ig in a lly m o d e le d
a f t e r th e A N S I c h a r a c te r s e t ( th u s its n a m e ) b u t h a s n o w b e e n b r o a d e n e d
to r e fe r to th e c u r r e n t lo c a le c h a r a c te r s e t.
W id e C h a r c h a r a c te r s u s e m o r e th a n o n e b y te to r e p r e s e n t e v e r y c h a r a c te r .
In th e c u r r e n t im p le m e n ta tio n s , W id e C h a r is w o r d - s iz e d ( 1 6 - b it) c h a r a c te r s
o r d e r e d a c c o r d in g to th e U n ic o d e c h a r a c te r s e t (n o te t h a t it c o u ld b e lo n g e r
in f u t u r e im p le m e n ta tio n s ) . T h e fir s t 2 5 6 U n ic o d e c h a r a c te r s c o r r e s p o n d to
th e A N S I c h a r a c te r s .
N o te
O n L in u x , w c h a r _ t w id e c h a r is 3 2 b its p e r c h a r a c te r . T h e 1 6 - b it U n ic o d e
s ta n d a r d t h a t D e lp h i W id e C h a r s s u p p o r t is a s u b s e t o f th e 3 2 - b it U C S
s ta n d a r d s u p p o r te d b y L in u x a n d th e G N U lib ra rie s . D e lp h i W id e C h a r d a ta
m u s t b e w id e n e d to 3 2 b its p e r c h a r a c te r b e fo r e it c a n b e p a s s e d to a n O S
fu n c tio n a s w c h a r _ t.
The
g e n e r ic
c h a r a c te r t y p e
is
C h a r,
w h ic h
is e q u iv a le n t to
A n s iC h a r .
B e c a u s e th e im p le m e n ta tio n o f C h a r is s u b je c t to c h a n g e , it's a g o o d id e a
to u s e th e s ta n d a r d fu n c tio n
w h e n w r itin g
S iz e O f r a th e r th a n a h a r d - c o d e d c o n s ta n t
p r o g r a m s t h a t m a y n e e d to h a n d le c h a r a c te r s o f d iffe r e n t
s iz e s .
A s tr in g c o n s ta n t o f le n g th 1, s u c h a s 'A ', c a n d e n o te a c h a r a c te r v a lu e .
T h e p r e d e fin e d f u n c tio n C h r r e tu r n s th e c h a r a c te r v a lu e f o r a n y in te g e r in
th e r a n g e o f A n s iC h a r o r W id e C h a r ; f o r e x a m p le , C h r ( 6 5 ) r e tu r n s th e le tte r
A.
C h a r a c te r
v a lu e s ,
in c r e m e n te d
lik e
p a s t th e
in te g e r s ,
b e g in n in g
w ra p
or end
a ro u n d
w hen
o f t h e ir
ra n g e
d e c r e m e n te d
( u n le s s
ra n g e -
c h e c k in g is e n a b le d ) . F o r e x a m p le , a ft e r e x e c u tio n o f th e c o d e
var
L e tte r: C h a r;
I: In te g e r;
b e g in
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
or
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 5 o f 15
L e tte r := H ig h ( L e tte r ) ;
f o r I := 1 to 6 6 d o
In c ( L e tte r) ;
end;
L e tte r h a s th e v a lu e A (A S C II 6 5 ).
e.
S tr in g ty p e s
A s tr in g r e p r e s e n ts a s e q u e n c e o f c h a r a c te r s . D e lp h i s u p p o r ts th e f o llo w in g
p r e d e fin e d s tr in g ty p e s .
S tr in g ty p e s
T y p e M a x im u m le n g th
S h o r tS tr in g
M e m o r y r e q u ir e d
U se d fo r
2 5 5 c h a r a c te r s
2 to 2 5 6 b y te s
b a c k w a rd
~ 2 A31 c h a r a c te r s
4 b y te s to 2 G B
8 - b it
c o m p a tib ility
A n s iS tr in g
( A N S I)
c h a r a c te r s , D B C S A N S I, M B C S A N S I, e tc .
W id e S tr in g
~ 2 A 3 0 c h a r a c te r s
4 b y te s to 2 G B
U n ic o d e
c h a r a c te r s ;
m u lt i- u s e r s e r v e r s a n d m u lt i- la n g u a g e a p p lic a tio n s
A n s iS tr in g , s o m e tim e s c a lle d th e lo n g s tr in g , is th e p r e fe r r e d ty p e f o r m o s t
p u rp o s e s .
S tr in g ty p e s c a n b e m ix e d in a s s ig n m e n ts a n d e x p r e s s io n s ; th e c o m p ile r
a u t o m a tic a lly
p e r fo r m s
r e q u ir e d
c o n v e r s io n s .
But
s tr in g s
passed
by
r e fe r e n c e to a f u n c tio n o r p r o c e d u r e (a s v a r a n d o u t p a r a m e te r s ) m u s t b e
o f th e a p p r o p r ia te ty p e . S tr in g s c a n b e e x p lic itly c a s t to a d iffe r e n t s trin g
t y p e (s e e T y p e c a s ts ) .
The
re s e rv e d
w o rd
s tr in g
f u n c tio n s
lik e
a
g e n e r ic
ty p e
id e n tifie r .
For
e x a m p le ,
v a r S: s tr in g ;
c r e a te s a v a r ia b le S th a t h o ld s a s tr in g .
c o m p ile r in te r p r e ts s tr in g ( w h e n
In th e d e fa u lt { $ H + } s ta te , th e
it a p p e a r s w ith o u t a b r a c k e te d
num ber
a f t e r it) a s A n s iS tr in g . U s e th e { $ H - } d ir e c tiv e to tu r n s tr in g in to S h o r tS tr in g .
T h e s ta n d a r d f u n c tio n L e n g th r e tu r n s th e n u m b e r o f c h a r a c te r s in a s trin g .
T h e S e tL e n g th p r o c e d u r e a d ju s ts th e le n g th o f a s tr in g .
s tr in g s
is
d e fin e d
b y th e
o r d e r in g
o f th e
c h a r a c te r s
in
C o m p a r is o n o f
c o r r e s p o n d in g
p o s itio n s . B e tw e e n s tr in g s o f u n e q u a l le n g th , e a c h c h a r a c te r in th e lo n g e r
s tr in g w it h o u t a c o r r e s p o n d in g c h a r a c te r in th e s h o r te r s tr in g t a k e s o n a
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 6 o f 15
g r e a te r - th a n v a lu e . F o r e x a m p le , " A B " is g r e a te r th a n "A "; t h a t is, 'A B ' > 'A '
r e tu r n s T ru e . Z e r o - le n g th s tr in g s h o ld th e lo w e s t v a lu e s .
Y o u c a n in d e x a s tr in g v a r ia b le ju s t a s y o u w o u ld a n a r ra y . If S is a s trin g
v a r ia b le a n d i a n in te g e r e x p r e s s io n , S [i] r e p r e s e n ts th e ith c h a r a c te r - - o r ,
s tr ic tly s p e a k in g , th e ith b y te - - in S. F o r a S h o r tS tr in g o r A n s iS tr in g , S [i] is o f
ty p e A n s iC h a r ; f o r a W id e S tr in g , S [i] is o f ty p e W id e C h a r . F o r s in g le - b y t e
( W e s te r n ) lo c a le s , M y S tr in g [2 ] := 'A '; a s s ig n s th e v a lu e A to th e s e c o n d
c h a r a c te r
of
M y S trin g .
The
f o llo w in g
code
uses
th e
s ta n d a r d
A n s iU p p e r C a s e fu n c tio n to c o n v e r t M y S tr in g to u p p e r c a s e .
v a r I: In te g e r;
b e g in
I := L e n g th ( M y S tr in g ) ;
w h ile I > 0 d o
b e g in
M y S tr in g [I] := A n s iU p p e r C a s e ( M y S tr in g [I]) ;
I := I - 1;
end;
end;
B e c a r e fu l in d e x in g s tr in g s in th is w a y , s in c e o v e r w r itin g th e e n d o f a s tr in g
c a n c a u s e a c c e s s v io la tio n s . A ls o , a v o id p a s s in g lo n g - s tr in g in d e x e s a s v a r
p a r a m e te r s , b e c a u s e th is r e s u lts in in e ffic ie n t c o d e .
Y o u c a n a s s ig n th e v a lu e o f a s tr in g c o n s t a n t - - o r a n y o t h e r e x p r e s s io n th a t
r e tu r n s a s tr in g - - t o a v a r ia b le . T h e le n g th o f th e s tr in g c h a n g e s d y n a m ic a lly
w h e n th e a s s ig n m e n t is m a d e . E x a m p le s :
M y S tr in g := 'H e llo w o r ld !';
M y S tr in g := 'H e llo ' + 'w o rld ';
M y S tr in g := M y S tr in g + '!';
M y S tr in g := ' ';
{ space }
M y S tr in g := '';
{ e m p ty s tr in g }
3 .3 . C o n s t a n t s
S e v e r a l d iffe r e n t la n g u a g e c o n s tr u c t io n s a r e r e fe r r e d to a s " c o n s ta n ts " . T h e r e
a r e n u m e r ic c o n s ta n ts ( a ls o c a lle d n u m e r a ls ) lik e
( a ls o
c a lle d
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
c h a r a c te r
s tr in g s
or
s tr in g
lite r a ls )
17 , a n d s tr in g c o n s ta n ts
lik e
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
'H e llo
w o r ld !'.
E v e ry
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
e n u m e r a te d
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
ty p e d e fin e s
P a g e 7 o f 15
c o n s ta n ts th a t r e p r e s e n t th e v a lu e s o f t h a t ty p e .
T h e r e a r e p r e d e fin e d c o n s ta n ts lik e T r u e ,
F a ls e , a n d n il. F in a lly , t h e r e a re
c o n s ta n ts th a t, lik e v a r ia b le s , a r e c r e a te d in d iv id u a lly b y d e c la r a tio n .
D e c la r e d c o n s ta n ts a r e e ith e r tr u e c o n s ta n ts o r ty p e d c o n s ta n ts . T h e s e tw o
k in d s o f c o n s ta n t a r e s u p e r fic ia lly s im ila r , b u t th e y a r e g o v e r n e d b y d iffe r e n t
ru le s a n d u s e d f o r d iffe r e n t p u rp o s e s .
P e n d e k la r a s ia n k o n s ta n ta d ila k u k a n d e n g a n s in ta k s b e rik u t:
const
nameof_konstanta = valueof_konstantam
,
e x a m p le :
const
M aksim um
= 10;
Log N a tu ra l
Bahasa
= 2 .7 1 8 2 8 1 8 2 8 ;
= 'O b je c t Pascal';
W e c o u ld d e te r m in e th e ty p e o f c o n s ta n t. It c a lle d ty p e d c o n s ta n ta .
e x a m p le :
const
M aksim um
: in te g e r = 10;
Log N a tu ra l
Bahasa
4.
5.
: d o u b le = 2 .7 1 8 2 8 1 8 2 8 ;
: S h o rtS trin g = 'O b je c t Pascal';
T o o l s a n d M a t e r ia ls
•
P e r s o n a l C o m p u te r
•
W in d o w s X P O p e r a tin g S y s te m
•
B o r la n d D e lp h i 7
W o r k S a fe ty
a.
B e fo r e p r a c tic in g , s tu d e n ts s h o u ld u n d e r s ta n d th e g o a l a n d c o m p e te n c y o f
th is p r a c tic e .
6.
b.
R e a d a n d u n d e r s ta n d a ll p r o c e d u r e s o f th is p r a c tic e c a r e fu lly .
c.
A lw a y s k e e p d a ta fro m lo s in g c a u s e s b y e x tin g u is h e d e le c tr ic ity .
P ro c e d u re s
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 8 o f 15
6 .1 . P r a k t i k P e n g g u n a a n T i p e B i la n g a n B u la t
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
In a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
U* tart r»—< *ir
**
•
O
la
# p ■
j .
►- a
x
'w ***?■
#
M
tM
M
t 'M
v l lM
w«m
k w
M
*J
U
M
I M
a 4
r
« n
D M w
W
1 4 «
J?
Label
LabeL
Label
L a b e l4 <
• I M
M
fmm
llt a k a
Ubf io ffl
t»«
M > i*»
)| M
I t t U i
UH *T _i*o «
Dl v J n m
l . t eVi t t
Cv » .
Lf cMf A' U»
r *>
-c
^ / » 4 i »u
1
l w»1
w
|l •«*. -— m »- •
• Jt V—
3.
S e t th e p r o p e r tie s o f e a c h c o m p o n e n t s a s fo llo w :
C om ponent
P r o p e r tie s
F o rm l
C a p tio n
T ip e B ila n g a n B u la t
L a b e ll
C a p tio n
x =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
y =
12
L a b e l2
F o n t - S iz e
L a b e l3
L a b e ll
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
V a lu e
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
x + y =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
C a p tio n
x * y =
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
S em e ste r 2
D a ta T y p e in P ro g ra m m in g
$
hours
4 x 5 0 m in s
4.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
E d it1
Text
E d it2
Text
E d it3
Text
E d it4
Text
B u tto n 1
C a p tio n
H itu n g
P a g e 9 o f 15
T h e r e s u lt is lik e p ic tu r e b e lo w :
x =:
H itu n g
x + y =
::x * y = [
5.
D o u b le C lic k o n B u tto n 1 , th e n w r ite c o d e p r o g r a m a s fo llo w :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
var
x , y , z: in te g e r;
b e g in
x := S trT o In t(E d it1 .T e x t);
y := S trT o In t(E d it2 .T e x t);
z := x + y ;
E d it3 .T e x t := In tT o S tr( z );
z := x * y ;
E d it4 .T e x t := In tT o S tr( z );
end;
6.
R u n p r o je c t b y c lic k in g t o o lb a r
C r e a ted b y :
S a m su l H ad i
a n d O th e rs
.
iJ
o r p re s s F 9 on y o u r k e y b o a rd .
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
7.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 10 o f 15
A f t e r p r o g r a m ru n n in g , e n tr y th e n u m b e r 3 a n d 4 s e q u e n tia lly o n E d it1 a n d
E d it2 , th e n c lic k b u tto n H itu n g . W e c a n s e e t h a t o n E d it3 w ill s h o w r e s u lt
3 + 4 = 7 a n d o n E d it4 w ill s h o w r e s u lt 3 * 4 = 1 2 lik e p ic tu r e b e lo w :
7
1 i|> c
4
H i l d n g d n
=
|3
y =
I4
X
| l'
m
H u l d l
i litLinq
im
p e l
'|
x ■ y = k
x * y
|iz
8.
T r y to e n tr y a n o t h e r n u m b e r o n E d it1 d a n E d it2 ju s t lik e s te p 7.
9.
S a v e y o u r p r o je c t a s T ip e D a t a 1 .
6 .2 . A p p l y i n g R e a l T y p e o n P r o g r a m m in g
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
n a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
----
►
M l
m
_ #
.
C
■
(B U
m
■ M l*
►
*
»
4 *
i
.
'• * » •
w
*
illlt M *
t
« W O .; I ■ ■
A
f y
« j
3
t e U
JSJ
*
•
I fi
M
t f
K
^
w
•»“ * *
*•
u
C « £ m
"
M
i£ > :
n a -M
I m
»
i Z m m O m
! 2«fcJ
£
Labe
Labe
Labe
Labe
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
3.
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 11 o f 15
S e t th e p r o p e r tie s o f e a c h c o m p o n e n t s a s fo llo w :
C om ponent
P r o p e r tie s
V a lu e
F o rm 1
C a p tio n
T ip e B ila n g a n R e a l
L a b e l1
C a p tio n
M e n c a r i L u a s d a n K e lilin g
L in g k a r a n
4.
F o n t - S iz e
12
F o n t - S ty le - f s B o ld
T ru e
L a b e l2
C a p tio n
M a s u k k a n n ila i ja r i- ja r i
L a b e l3
C a p tio n
L u a s lin g k a r a n =
L a b e l4
C a p tio n
K e lilin g lin g k a r a n =
E d it1
Text
E d it2
Text
E d it3
Text
B u tto n 1
C a p tio n
H itu n g
T h e r e s u lt is lik e p ic tu r e b e lo w :
M e n c a r i L u a s d a n K e lilin g L in g k a r a n
M a s u k k a n n ilai jari-jari- • P
H itun g
L u a s lin g k a ra n =
K eliling lin g k a ra n -
5.
D o u b le C lic k o n B u tto n 1 , th e n w r ite c o d e p r o g r a m a s fo llo w :
p r o c e d u r e T F o rm 1 .B u tto n 1 C lic k (S e n d e r: T O b je c t);
var
ja ri_ ja ri: re a l;
lu a s _ lin g k a ra n : re a l;
k e lilin g jin g k a r a n : re a l;
const
phi = 3 .1 4 ;
b e g in
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
$
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
P a g e 12 o f 15
ja ri_ ja ri := S trT o F lo a t(E d it1 .T e x t);
lu a s_ lin g ka ra n := 2 * phi * ja ri_ ja ri;
E d it2 .T e x t := F lo a tT o S tr(lu a s _ lin g k a ra n );
k e lilin g _ lin g k a ra n := phi * ja ri_ ja ri * ja ri_ ja ri;
E d it3 .T e x t := F lo a tT o S tr(k e lilin g _ lin g k a ra n );
end;
6.
7.
R u n p r o je c t b y c lic k in g t o o lb a r
A fte r p ro g ra m
o r p re s s F 9 on y o u r k e y b o a rd .
ru n n in g , e n tr y th e n u m b e r 5 o n E d it1 , c lic k b u tto n H itu n g ,
th e n E d it2 w ill s h o w c ir c le v a s t a s 3 1 ,4 a n d E d it3 w ill s h o w c ir c le a r o u n d
e q u a l to 7 8 ,5 lik e s h o w n b e lo w :
7 ' T ip e B ila n g a n R e a l
K
U
j
I
M e n c a r i L u a s d a n K e lilin g L in g k a r a n
M a s u k k a n r i a i jari-jari
F ~
1
!
H itu n g
!
1
L u a s lin g k a ra n =
13 1 .4
K eliling lin g k a ra n =
|7 8 .5
8.
T r y to e n tr y a n o t h e r n u m b e r o n E d it1 d a n E d it2 ju s t lik e s te p 7.
9.
S a v e y o u r p r o je c t a s T ip e D a ta 2 .
6 .3 . A p p ly in g
B o o le a n T y p e o n P r o g r a m m in g
1.
R u n B o r la n d D e lp h i 7 o n y o u r c o m p u te r .
2.
In a c tiv e fo r m , s e le c t c o m p o n e n t s a n d p la c e o n fo r m lik e p ic tu r e b e lo w :
C r ea te d b y :
S a m su l H ad i
a n d O th e rs
P r o h ib ite d to r e p r o d u c e in p a r t o r w h o le d o c u m e n t w it h o u t
p e r m is s io n o f th e F a c u lt y o f E n g in e e r in g , Y o g y a k a r t a S ta te
U n iv e r s it y
R e v ie w e d b y :
F A C U L T Y O F E N G IN E E R IN G
Y O G Y A K A R T A S T A T E U N IV E R S IT Y
L A B S H E E T (A D V A N C E D P R O G R A M M IN G )
C la s s ic a l
D a ta T y p e in P ro g ra m m in g
S em e ste r 2
hours
4 x 5 0 m in s
N o.
R e v is io n :
D a te :
L S C P /E K O /D E L 2 2 4 /0 3
01
M arch, 1 2 0 0 9
t * n |» '
**
*
.’S
&• (4 It
J r
P»«Ht «O' 'M tn n
i , J, +
^ - i
b
! / ! '« *
■*! Si‘
.
-1+1’
'K *
in n
IW ta m 0«toLv*Q*l M om r
a «
*j
“
P a g e 13 o f 15
«1
DOfc 1
“=
»l««n
1
mm*lmw- >*11* wM m
D«*eLi*e t»#-1--*
U
7
f* fo < «
u fi * *
3 »
3 1 *» '
■ 691
________
- r
Edit1
—
— ------------------------------------------------------
(||M W HIW
► B utton1
•
— a
•M
'*»•
OV.M
ic m