Declaration Section In Algorithm
In the algorithm, the declaration or dictionary is the part to define all the names used in the algorithm. The name can be a variable name, a constant name, a name for which the procedure or function name. All of these names can only be used in the algorithm if it has been defined first in the declaration section.
Writing a set of names in the declaration section should be grouped by type. Defining the name of a constant also gives a constant value. Defining the name of the function or procedure as well by defining the specification and its parameters.
The following is a common form of declaration section:
The following is an example part of the algorithm declaration calculating the area of the circle:
Similarly this article.
Sorry if there is a wrong word.
The end of word wassalamualaikum wr. wb
Referensi :
Writing a set of names in the declaration section should be grouped by type. Defining the name of a constant also gives a constant value. Defining the name of the function or procedure as well by defining the specification and its parameters.
The following is a common form of declaration section:
Declaration:
{Variable type name that is not the base data type}
Type of time: <hh: mm: ss: integer> {Time type consists of 3 input data "hh" as hour, "mm" as minute, and "ss" as second}
{Constant name, must specify data type and value}
Constant PHI: real = 3.14159265389793
Constant E: real = 2.718281828459045
{Name of variable using basic data type}
Name: String {a value that is a character set}
Found: boolean {a logical value (true or false)}
Weight: real {a fractional value}
NumberofChildren: integer {an integer value}
{Function name, defines domain, name, number, type and parameter, and output data type}
additional function (x: int, y: int): int
{process: add two data values and addition result as output value of function}
{Variable type name that is not the base data type}
Type of time: <hh: mm: ss: integer> {Time type consists of 3 input data "hh" as hour, "mm" as minute, and "ss" as second}
{Constant name, must specify data type and value}
Constant PHI: real = 3.14159265389793
Constant E: real = 2.718281828459045
{Name of variable using basic data type}
Name: String {a value that is a character set}
Found: boolean {a logical value (true or false)}
Weight: real {a fractional value}
NumberofChildren: integer {an integer value}
{Function name, defines domain, name, number, type and parameter, and output data type}
additional function (x: int, y: int): int
{process: add two data values and addition result as output value of function}
The following is an example part of the algorithm declaration calculating the area of the circle:
Declaration:
radius = real {data type of fractional}
area = real {type of fractional data}
PHI = 3.14
radius = real {data type of fractional}
area = real {type of fractional data}
PHI = 3.14
Similarly this article.
Sorry if there is a wrong word.
The end of word wassalamualaikum wr. wb
Referensi :
- Ebook Logical and Algorithm
0 Response to "Declaration Section In Algorithm"
Posting Komentar