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 edit
Data Types:
Integer
Real
String
Character
Syntax:
Declare DataType VariableName
Declare DataType ArrayName[Size]
Constants edit
Syntax:
Constant DataType Name = Value
Comments edit
Syntax:
// Comment
Input / Output edit
Syntax:
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 edit
AND
(And)OR
(Or)NOT
(Not)
Conditional Statements edit
If 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 edit
While 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 edit
Module ModuleName(DataType ParameterName, ...) statements End Module
Function FunctionName(DataType ParameterName, ...) statements Return value End Function
Call ModuleName(parameter, ...) Variable = FunctionName(parameter, ...)
File Processing edit
Declare 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 edit
Class 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