Pseudocode/Gaddis Pseudocode
Gaddis Pseudocode refers to the pseudocode language described in the book, "Starting Out with Programming Logic and Design", by Tony Gaddis. The language includes elements for variables, named constants, comments, input / output, operators, conditional statements, loops, subroutines, file processing, and classes.
Variables
editData Types:
Integer
Real
String
Character
Syntax:
Declare DataType VariableName
Declare DataType ArrayName[Size]
Constants
editSyntax:
Constant DataType Name = Value
Comments
editSyntax:
// Comment
Input / Output
editSyntax:
Input VariableName
Display item, ...
item
must be a variable or literal
Math Operators
edit+
(Add)-
(Subtract)*
(Multiply)/
(Divide)MOD
(Modulus)^
(Exponent)
Relational Operators
edit>
(Greater than)<
(Less than)>=
(Greater than or equal to)<=
(Less than or equal to)==
(Equal to)!=
(Not equal to)
Logical Operators
editAND
(And)OR
(Or)NOT
(Not)
Conditional Statements
editIf condition Then statements End If
If condition Then statements Else statements End If
Select expression Case value: statements Case value: statements Default: statements End Select
Loop Statements
editWhile condition statements End While
Do statements While condition
Do statements Until condition
For counter = start To end statements End For
For Each variable In array statements End For
Subroutines
editModule ModuleName(DataType ParameterName, ...) statements End Module
Function FunctionName(DataType ParameterName, ...) statements Return value End Function
Call ModuleName(parameter, ...) Variable = FunctionName(parameter, ...)
File Processing
editDeclare InputFile VariableName Declare OutputFile VariableName Declare OutputFile AppendMode VariableName Open VariableName FileName Read VariableName VariableName Write VariableName item Close VariableName Open VariableName FileName While NOT eof(VariableName) statements End While Close VariableName Rename FileName, NewName Delete FileName
Classes
editClass ClassName Private DataType FieldName ... Public Module ModuleName(DataType ParameterName, ...) statements End Module ... Public Function FunctionName(DataType ParameterName, ...) statements End Function .... End Class Declare ClassName VariableName Set VariableName = New ClassName()
Bibliography
edit- Gaddis, T. (2016). Starting Out with Programming Logic and Design, 4th Edition. Pearson. ISBN 9780133998160