



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























What are each of the following symbols?
Input / Output Process – Maths operations and assignment of variables Line – shows direction of flow Terminal – for start and stop Decision – change flow based on a decision Sub program – call a different function or procedure What are each of the following symbols?
Some preliminaries …
Data types You will use the following data types in your algorithms: Data type Description Example INTEGER A whole number 1475 , 0 , - REAL A number with a decimal point 56.75, 6.0, -2.456, 0. BOOLEAN Either TRUE or FALSE TRUE, FALSE CHARACTER A single alphabetic or numeric character 'a', 'K', '4', '@', '%' STRING A sequence of one or more characters "Jo Hobson", "123"
What do these symbols/keywords mean? Symbol / keyword Meaning Symbol / keyword Meaning < (^) Less than / (^) Divide <= Less than or equal to if elseif else Branch depending on condition > (^) Greater than switch case default Branch depending on case >= Greater than or equal to input() Get user input == (^) Equal to print() (^) Output to the user = Assignment for Repeat a set number of times != (^) Not equal to while (^) Repeat while a condition is true ***** Multiply do until Do a loop until a condition is true ^ Exponent str() Convert to a string + (^) Addition or concatonte int() (^) Convert to an integer
Boolean operators The following operators are used to compare two values
greater than = greater than or equal to < less than <= less than or equal to == equal to != not equal to
Boolean expressions A Boolean expression evaluates to TRUE or FALSE
Introducing pseudocode Pseudocode is a kind of structured English for describing algorithms
Programming constructs Last lesson we covered three basic ways of controlling the flow of a program:
Selection
The switch/case statement
Assignment pseudocode
Pseudocode for input/output Most programs that you will write will ask the user to enter some data, and then accept the user input and assign it to a variable