Pascal Control Structures PDF

Title Pascal Control Structures
Author Daniel Kaba
Course Programming
Institution University of Northampton
Pages 37
File Size 468 KB
File Type PDF
Total Downloads 1
Total Views 144

Summary

Lectures Notes...


Description

       !!"# •

"



"



$%&%'

 !(    ! ! 



)

*

+

,

-

$!

+)

,

-)

$

-+

.*



Control Structures-Selection

1

 & !!( 





 



 





/0 #1 22-2(2-22-22-232   " *     ! "    !  "#$%&'#()" ! !&4!0*.      

Control Structures-Selection

2

*+ %&$)+"#()  -5 +    )+, " 678'( '9&5:; 'A:;

). )+/  9&5:; B' 

C/#&;

)0% 

>9?*!.#?:;



'9C/:;



&9C,5/)7:!0*.





>9C?&(?/:;

) . 

Control Structures-Selection

3

#$&!4*" !The &D!D* 2D292&2de and the "Else" side). !&4!0*.4*$"*    

   9 : *+  &- +! -5 + * -5 +;           

Control Structures-Selection

4

)+, 9&5:; 9C?&(?/:

>9C?&.5!(?/:;

) .  )+/ $E&9&5:; 9C?&$!?/:

>9/?&.5!(?C:;

) . 

Control Structures-Selection

5

)+1 $9&5:; 9?!,&?,:; ) . Control Structures-Selection

6

#$%3" >    #

  &,#  9.:&  )+$"!%3 &*+4 &- G+! - G+ *&- H+! - H+  *&- +! - + * -  +;  .*&222&2 2*2.*& 2 G2  *&; 2 G22 H2D 2 H2  *&     *&! Control Structures-Selection

7

*  &* &  )+4  &+)67! >9?@A: *&+)I7! >9?@(A: *&)J7! >9?@A: *&+)H7! >9?@A: *  >9?@*A:;  #  A !%" #  -!* +& - G+#-G+; - H+#-H+; 4 ) -+ )5  !#!  * 9:  !     *! *      )+4 )& 67G77#>9?@A: I7KL#>9?@(A: J7ML>9?@A: H7NL>9?@A: 7GL >9?@*A: *  >9?&@A:; ).    Control Structures-Selection

8

#+667*338 34  & )+ - +O P GG7G77 2/222 - +- + GL 2222 9: MH7HLJN  *C,$*"

Control Structures-Selection

9

))#%#%%#)#%#9#9)$" & $   G >4 H '41 N    #8' &D9   !'1*: !Q *+ >9* : ";   &       #'9 &D9   !  !'1*:!'4  *+ ' ";  19* :;

Control Structures-Selection

10

  &   'D1     

FOR ….Do Loop A for loop executes a section of code for a fixed number of times. The for loop is used you already know the number of times a section of code is going to be executed. Syntax FOR Loop Control Var := Initial Value TO Final Value DO Statements; OR FOR Loop Control Var := Final Value DOWNTO Initial Value DO Statements; Example

Control Structures-Selection

11

) 9) &9#% ) 9) D  %    $:8" & 9  : 0%3$%;"5 @ ! @B '5*1'*  '5*1'* )0% 

, ;

) .AG6  %9# 9#9#& #%A &'%' U !>%>   %3* '9'OGP:; '9"OHP:; '9@ONP:;  *3*$3" >9'OGP:; >9"OHP:; 

Control Structures-Selection

22

)+ E9&5:; 9?A:;



>9?GA"OGP#J:;



>9?HA"OHP#J:;



>9?NA"ONP#J:;



>9?JA"OJP#J:;



>9?MA"OMP#J:;

) .9??& "O& P#J:;





 ) .#"



& G& H#&;



,#(;

 

=



>9?*!>A:;'9>:;



& G#)G;



& H#)59O7P:;9>?&A:

>9>?&.5!A:;

) .=



B#)7; O P:5





?A?A?A?A?A#B#)BSG;





?A?*A?&A?5A?1A#B#)BSG;

Control Structures-Selection

26







*;

*;

 

9"OHHP:; )?) > G H N H J I N I L J 6 GH M G7 GM I GH G6 HEEE9&5:; - !#''/OGIGMP5&; /#&;   >9?!,!A:;  #)G!I  (   #)G!M   (    #)R;    9#J:;    OP#);   *;   >;  *; ).

Control Structures-Selection

J 6 GH GI H7 HJ

M H7 GM H7 HM N7

29

)+/5 !1    J I H 7 M N 6 K L 7 GG GN ># :  : &Q : "   3/ * B' .#''/OGNGJP5&;  %C373A ( .OGGP#)J; .OGHP#)I; .OGNP#)H; .OGJP#)7; .OHGP#)M; .OHHP#)N; .OHNP#)6; .OHJP#)K; .ONGP#)L; .ONHP#)7; .ONNP#)GG; .ONJP#)GN; *; !  )(%0 #%0 #%0 ""     !   #%0#)(%@9) "   !"   "  Control Structures-Selection

30

 ! # : (" : &" : "" : T" : ""  9)# !! U   (8%:! !    ! !    )+, B$%;"5 -  #''/OGIP5&;  !U#&;   >9?* *?:;  #)G!I9?* *?:;  #)G!I9?!"$A:;  #)G!I   >9OP:; ).  )(%0 " &  5 !# G $%"" H ("  %))@9)#%)( &   &  &  Control Structures-Selection

34

 )+ $" *9M7J7KMMML7JM:> MM  B$%;"5 -  #''/OGIP5&;  &$#&;  #(;   #);  >9?* *?:;  #)G!I9?!&#?$:  *   >9?!.5!A:; ).  )+/*&  B$%;"5 #A)  $)''/OGIP5&;  -  #$;  &$#&;  #(;  &$*4*5+4%"4%5  #)G!I  (   &9OP) :!9R,R:   (    $#); Control Structures-Selection

35

   #)!;   *;  *; )59?!.5!A:; ).  %A)( !(VW&  &   (:%#:D ! &9:! ...


Similar Free PDFs