Structure charts can map the structure and data flow of complicated tasks
A Structure Chart in software engineering is a chart which shows the breakdown of a system to its lowest manageable parts. They are used in structured programming to arrange program modules into a tree. Each module is represented by a box, which contains the module's name. The tree structure visualizes the relationships between modules, showing data transfer between modules using arrows. Structured Charts are an example of a top-down design where a problem (the program) is broken into its components.
Each Box represents a programming module, this might be something that calculates the average of some figures, or prints out some pay slips
Data being passed from module to module that needs to be processed.
[Extension - you don't need to know this for the exam] Check data sent to process to stop or start processes. For example when the End of a File that is being read is reached, or a flag to say whether data sent was in the correct format
Let's take a look at a simple example of how this might be executed when representing the following code:
Using the semi circular arrow we can represent iteration in Structure Charts. The arrow encompasses a link to a module, implying that module is executed multiple times. Let's take a look at a coded example:
Exercise: Structure Charts, Iteration and Selection
Create structure charts for the following code:
subhowManyThrees()dimnum1,count,totalasintegernum1=startMsg()count=0total=0whilenum1>0docheckNumber(count,total,num1)num1=num1-1endwhileendMsg(count)endsubsubcheckNumber(byRefc,byReft,byValn)IfnMOD3=0Thenc=divBy3(c)Elset=add(n,t)EndIfendsubfunctiondivBy3(x)returnx+1endfunctionfunctionadd(n,t)returnn+tendfunctionfunctionstartMsg()console.writeline("program started, enter your number")returnconsole.readline()endfunctionsubendMsg(n)console.writeline("number of threes : "&n)endsub