DESIGN TOOLS Programming FOR ASO 1 WE WILL

  • Slides: 16
Download presentation
DESIGN TOOLS Programming

DESIGN TOOLS Programming

FOR ASO 1 WE WILL LOOK AT: Pseudocode

FOR ASO 1 WE WILL LOOK AT: Pseudocode

PSEUDOCODE Designing a Program

PSEUDOCODE Designing a Program

WHAT IS AN ALGORITHM? It’s a procedure for solving problems. It shows actions to

WHAT IS AN ALGORITHM? It’s a procedure for solving problems. It shows actions to be executed by a sequence of steps taken to solve a problem. Pseudocode is an informal language that helps programmers to develop algorithms. It’s mainly written in plain English, but still has a style guide of how to format and write the pseudocode.

RULES FOR WRITING PSEUDOCODE: Pseudocode has some basic standards to make it easier for

RULES FOR WRITING PSEUDOCODE: Pseudocode has some basic standards to make it easier for everyone to read and follow what your algorithm is all about. *Note sometimes the rules can vary slightly

INDENTATION IS VERY IMPORTANT!!!!

INDENTATION IS VERY IMPORTANT!!!!

USE IMPORTANT KEY WORDS Set Get Print/Display Call (For Use of Modules) Return Store

USE IMPORTANT KEY WORDS Set Get Print/Display Call (For Use of Modules) Return Store Add/Subtract Increment Repeat

STARTING A PROCEDURE BEGIN Procedure (Your book says Start not Begin) … … …

STARTING A PROCEDURE BEGIN Procedure (Your book says Start not Begin) … … … END Procedure (Your book says Stop not End)

IF BEGIN Procedure IF Condition … … END IF END Procedure

IF BEGIN Procedure IF Condition … … END IF END Procedure

EXAMPLE: BEGIN Print. Word Get Number IF Number == 1 Print One END IF

EXAMPLE: BEGIN Print. Word Get Number IF Number == 1 Print One END IF END Print. Word See INDENTATION!

IF/ELSE BEGIN Procedure IF Condition … … ELSE … … END IF END Procedure

IF/ELSE BEGIN Procedure IF Condition … … ELSE … … END IF END Procedure

EXAMPLE: BEGIN Print. Word Get Number IF Number == 1 Print One ELSE Print

EXAMPLE: BEGIN Print. Word Get Number IF Number == 1 Print One ELSE Print Hello END IF END Print. Word

WHILE BEGIN Procedure WHILE Condition … … END WHILE END Procedure

WHILE BEGIN Procedure WHILE Condition … … END WHILE END Procedure

EXAMPLE: BEGIN Tally Set Count to 1 WHILE Count <=30 Total(Item(Count))=Total(Item(Count))+1 Add 1 to

EXAMPLE: BEGIN Tally Set Count to 1 WHILE Count <=30 Total(Item(Count))=Total(Item(Count))+1 Add 1 to Count END WHILE Print Total END Tally

FOR BEGIN Procedure FOR Condition … … END FOR END Procedure

FOR BEGIN Procedure FOR Condition … … END FOR END Procedure

BEGIN Print. Letter Get Word FOR letter in Word Print current letter END FOR

BEGIN Print. Letter Get Word FOR letter in Word Print current letter END FOR END Print. Letter