pascal中数组集合怎么定义?

在pascal中,如何定义数组集合?为什么我的老是‘illegal type declaration of set elements'?可否给个定义样例?

type set_name_1 = set of 1..10;type set_name_2 = set of char;基类型最大不超过255,你要求的10000可能没法实现. 以下是HELP中剪的结果:---------------------------------------------------------------------------1. set (reserved word)
Syntax:
set of type Remarks:
The base type of a set must be an ordinal type
with no more than 256 possible values.The ordinal values of the upper and lower
bounds of the base type must be between 0 and
255.A set constructor, which denotes a set-type
value, is formed by writing expressions within
brackets. Each expression denotes a value of
the set.The notation [ ] denotes the empty set, which
is compatible with all set types. Example:
{ Set types }
type
Day = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
CharSet = set of Char;
Digits = set of 0..9;
Days = set of Day; { Set constructors } ['0'..'9', 'A'..'Z', 'a'..'z', '_']
[1, 5, I + 1 .. J - 1]
[Mon..Fri] See Also:
Set-type constants2. Set-type constants
The declaration of a set-type constant
specifies the value of the set using a
constant expression. Examples:
type
Digits = set of 0..9;
Letters = set of 'A'..'Z';
const
EvenDigits: Digits = [0, 2, 4, 6, 8];
Vowels: Letters = ['A', 'E', 'I', 'O', 'U', 'Y'];
HexDigits: set of '0'..'z' = ['0'..'9', 'A'..'F', 'a'...f'];
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-08-11
集合是由具有某些共同特征的元素构成的一个整体。在pascal中,一个集合是由具有同一有序类型的一组数据元素所组成,这一有序类型称为该集合的基类型。
你说的数据集合是什么意思?
第2个回答  2013-08-11
集合a,b,c :set of 1..12;(整型集合,范围1~12)d,e,f :set of 'a'..'z';(字符集合,范围‘a’~‘z’)
相似回答