Declaration Department Inwards Algorithm

In the algorithm, the proclamation or lexicon is the component subdivision to define all the names used inwards the algorithm. The advert tin endure a variable name, a constant name, a advert for which the physical care for or component subdivision name. All of these names tin exclusively endure used inwards the algorithm if it has been defined showtime inwards the proclamation section.

Writing a laid upward of names inwards the proclamation department should endure grouped past times type. Defining the advert of a constant likewise gives a constant value. Defining the advert of the component subdivision or physical care for equally good past times defining the specification in addition to its parameters.

The next is a mutual shape of proclamation section:

Declaration:
{Variable type advert that is non the base of operations information type}
Type of time: <hh: mm: ss: integer> {Time type consists of three input information "hh" equally hour, "mm" equally minute, in addition to "ss" equally second}

{Constant name, must specify information type in addition to value}
Constant PHI: existent = 3.14159265389793
Constant E: existent = 2.718281828459045

{Name of variable using basic information type}
Name: String {a value that is a grapheme set}
Found: boolean {a logical value (true or false)}
Weight: existent {a fractional value}
NumberofChildren: integer {an integer value}

{Function name, defines domain, name, number, type in addition to parameter, in addition to output information type}
additional component subdivision (x: int, y: int): int
{process: add together 2 information values in addition to add-on lawsuit equally output value of function}


The next is an lawsuit component subdivision of the algorithm proclamation calculating the expanse of the circle:

Declaration:
radius = existent {data type of fractional}
area = existent {type of fractional data}
PHI = 3.14


Similarly this article.
Sorry if at that topographic point is a incorrect word.
The terminate of give-and-take wassalamualaikum wr. wb

Referensi :
  • Ebook Logical in addition to Algorithm

Artikel Terkait