User defined scalar data types

Interval type

The interval type identifier is specified by the programmer. An interval is a type that does not specify a continuous subset of values of some ordinal type. The lower and upper bounds of the subset indicate the two constants of the given standard type (given in the definitions) that are in this order in the interval list.

The advantage of defining custom data types is to use the type values of the object enters in a real environment. We also gain the benefits of controlling an object, whether it acquires values of the given type, that is, admissible values, for example in verbal tasks.


Operations

 smaller

 bigger  

=   equal 

<=   smaller or equal 

>=   bigger or equal

<>   not equal 


Standard functions

suc successor

pre predecessor

ord serial number

chr the value chr(i) is a character whose value of the ordinal number is i 


Type defined by naming values

The identifier of the specified type is defined by the programmer himself. Restriction of data definition of the type defined by the naming of the values, results from the unambiguous determination of the values of this data type. The programmer can define a linear array of values that are based on identifiers.

The used identifiers are considered for the given program as constants of the specified type, to which they belong. Each of the used constants has a matching number in the identifier responsible for its order in defining the type. The first identifier is 0, the second 1, and so on. On declaration variables of the specified type, it is necessary to use a clause (addition) type, for example:

type week = (mon, tue, wed, thu, fri, sat, sun);

Variables of this type can only be derived from this list of constants.

Although this data type belongs to standard scalar data types, it is not used often in programming separately. Mostly we can use it in connection with the data type set (see below). Nevertheless, we can include it among scalar data types. 


Operations

<   smaller

>   bigger 

=   equal 

<=   smaller or equal

>=   bigger or equal 

<>   not equal 


Standard functions

suc successor

pre predecessor

ord serial number

chr the value chr(i) is a character whose value of the ordinal number is i 

Vytvorte si webové stránky zdarma! Táto stránka bola vytvorená pomocou služby Webnode. Vytvorte si vlastný web zdarma ešte dnes! Vytvoriť stránky