1、正确,就是这样,你还想怎样?
2、pStudent : array[0..3] of TStudent = (
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100));
3、集合类型,Pascal特有,和数学中的集合概念等同。I think
if ssShift in Shift then
is better。
4、[]中的是Open Array,和动态数组类似。Delphi不向C,它是强类型,对于可变参数,它没有...,用Open Array代替,功能等同。
2、pStudent : array[0..3] of TStudent = (
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100),
(m_szName : 'Borland'; m_nAge : 12; m_nId : 100));
3、集合类型,Pascal特有,和数学中的集合概念等同。I think
if ssShift in Shift then
is better。
4、[]中的是Open Array,和动态数组类似。Delphi不向C,它是强类型,对于可变参数,它没有...,用Open Array代替,功能等同。
if a=1 then
operation1
else if b=1 then
operation2
else if c=1 then
operation3
else
operation4;
集合类型
[]中可以加入几个变量,
你的改法是正确的,
数组初始化同意楼上的。
这样
[元素1,元素2……]
就可以将元素变为集合
如题:
[nTemp]
表示 为一个整数集合,集合有一个元素 是nTemp
而Format的第二参数是 任何类型的集合
何C中的printf相似
如:
[1,7.2,'aaa']计算机如何在内存中存放这个集合?因为三个元素都不是等长的
基本就是这样;
2)请问怎样给全局结构体数组初始化,很简单的问题
Delphi自动给全局变量赋初值;
3)上面的语句表示TShiftState是什么类型(好像不是枚举类型)
是集合,只有PASCAL才有的类型,当元素少于32个时就存储在寄存器里,使用性能很高;
4)还有下面的从书上抄来的语句为什么可以判断出按了那个键?它的算术很怪
你确定是>=而不是=吗?
5)'[]'不是表示数组引用吗?
这就是一个由常量组成的数组,它只有一个元素,nTemp。在Format函数中nTemp是不被修改的(不变的),所以被声明成常量。
The range of a set type is the power set of a specific ordinal type, called the base type; that is, the possible values of the set type are all the subsets of the base type, including the empty set. The base type can have no more than 256 possible values, and their ordinalities must fall between 0 and 255. Any construction of the formset of baseTypewhere baseType is an appropriate ordinal type, identifies a set type.这是从Delphi的帮助里copy 的
if (a==1)
operation1;
else if (b==1)
operation2;
else if (c==1)
operation3;
else
operation4;可以写成如下:
if a=1 then
operation1
else if b=1 then
operation2
else if c=1 then
operation3
else
operation4;