Please enable JavaScript.
Coggle requires JavaScript to display documents.
Ch.23 Algorithm Design(2) - Coggle Diagram
Ch.23 Algorithm Design(2)
23.1 Input Statements, Output Statement and Assignment Statments
Input Statements
to process data and to generate outputs
variables are used to temporarily store the data inputted by users when a program is running
a program should be made flexible to handle different datasets without having to change the program code.
can handle datas:
a no.
a character
a string
Output Statements
used to output the process input.
output can be displayed on the screen, saved to a file or printed on paper
usually formatted to make it more readable
Assignment Statements
used to place a value of the vale of an expression into a variable
use the '<---'symbol to denote the assignment operator used in flowcharts and in pseudocode
23.2 Basic Control Structures
simplest type: computer programming
to contain a series of steps or statements that are executed in the same order as they are written
Selection control structure
tow types of selection control structure
decision logic structure
works much like the way humans think
easy to understanding
case logic structure
to make a decision from more then one possible value of and expression
only one option is selected for executed
Iteration
common kinds of loops
For-loop
pre-test loop
WHILE-loop
will continue to run as long as the condition is sstidfied
Do...WHILE-loop
if the condition is satisfied, the loop-body will be executed again
REPEAT...UNTIL-loop
when a program comes to a REPEAT...UNTIL-loop, the loop-body wi;; continue to run until a condition called the 'exit' conditions met
Arrays
oragainzing a collection of homogenous data items
grouping data items into a single data structure
23.4 advantages of using the modular approach in programming
each module can be tested separately
easier to understand and debug a module
save a lot of time