MELJUN CORTES Algorithm Flowchart Symbols

669 views

Published on

MELJUN CORTES Algorithm Flowchart Symbols

1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
669
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
16
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

MELJUN CORTES Algorithm Flowchart Symbols

  1. 1. Algorithm Representation Symbol Usage Terminal – Begin / End Begin / End There should only be one Begin and one End in the algorithm. Subprograms have their own Begin and End. Process Process – initialisation (setting start-up values); assignment (setting values) or calculation Input / OutputInput / Output Decision: selection or repetition This symbol is used to show any condition that is tested. There are two types of selection: binary and multi-way. Binary selection can be expanded to multi-way through Decision nested IF statements. However, CASE statements are a more efficient way of coding multiple paths. There are two types of repetition: guarded / pre-test or unguarded/ post-test. Guarded loops test the condition before executing the statements within the loop. Unguarded loops test the condition after executing the statements within the loop once. WHILE loops must be primed – the variable(s) tested in the condition must be set prior to the beginning of the loop. Fixed iteration loops are a form of guarded loops which run a set number of times (although this can be determined by the value of variables). They are useful because the incrementation of the condition value is automatic. The variables that are tested in the condition must be updated in the loop. If the value doesnt change the loop will continue forming an infinite loop. Subprogram – a subprogram is a section of code that can be reused any number of times during the program. Variables can be passed into subprograms in the form of arguments / Subprogram parameters to allow for minor changes in the running of the subprogram. Subprograms are procedures or functions and can be created by the programmer or preexisting.
  2. 2. Usage PseudocodeTerminal – Begin / End BeginThere should only be one Begin and one End in the Endalgorithm. Subprograms have their own Begin andEnd.Process – initialisation (setting start-up values); Variable = Xassignment (setting values) or calculation Set VariableName to XInput / Output Get value / Accept value Display value / Print valueDecision: selection or repetition Binary selection:This symbol is used to show any condition that is IF (condition) THENtested. statements ELSEThere are two types of selection: binary and multi- statementsway. Binary selection can be expanded to multi-way ENDIFthrough nested IF statements. However, CASEstatements are a more efficient way of coding Multi-way selection:multiple paths. CASEWHERE expression is value : statementsThere are two types of repetition: guarded / pre-test or value : statementsunguarded/ post-test. Guarded loops test the OTHERWISE : statementscondition before executing the statements within the ENDCASEloop. Unguarded loops test the condition afterexecuting the statements within the loop once. Guarded loops: WHILE conditionWHILE loops must be primed – the variable(s) tested statementsin the condition must be set prior to the beginning of ENDWHILEthe loop. FOR (a fixed number of iterations)Fixed iteration loops are a form of guarded loops statementswhich run a set number of times (although this can be ENDFORdetermined by the value of variables). They areuseful because the incrementation of the condition Unguarded loops:value is automatic. REPEAT statementsThe variables that are tested in the condition must be UNTIL conditionupdated in the loop. If the value doesnt change theloop will continue forming an infinite loop.Subprogram – a subprogram is a section of code that SubprogramName (Parameters)can be reused any number of times during theprogram. Variables can be passed into subprograms in (Note: in pseudocode, subprograms arethe form of arguments / parameters to allow for minor simply represented by underlining the namechanges in the running of the subprogram. of the subprogram.)Subprograms are procedures or functions and can becreated by the programmer or preexisting.

×