码迷,mamicode.com
首页 > 编程语言 > 详细

数组与枚举

时间:2017-02-03 18:36:17      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:logs   星期六   sage   rda   strong   http   html   ref   www   

万一老师博客:http://www.cnblogs.com/del/archive/2008/01/09/1031196.html

----------------------------------------------------------------------------------------

type
  TMyEnum = (Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday); {定义枚举}
var
  weekArr: array[TMyEnum] of string; {定义数组}
  myEnum: TMyEnum;                   {定义枚举变量}
begin
  {数组赋值}
  weekArr[Monday]    := ‘星期一‘;
  weekArr[Tuesday]   := ‘星期二‘;
  weekArr[Wednesday] := ‘星期三‘;
  weekArr[Thursday]  := ‘星期四‘;
  weekArr[Friday]    := ‘星期五‘;
  weekArr[Saturday]  := ‘星期六‘;
  weekArr[Sunday]    := ‘星期天‘;

  {调用数组}
  ShowMessage(weekArr[Sunday]); {星期天}

  {遍历数组}
  for myEnum := Low(weekArr) to High(weekArr) do
  begin
    ShowMessage(weekArr[myEnum]); {将分别显示: 星期一 ... 星期天}
  end;
end;

数组与枚举

标签:logs   星期六   sage   rda   strong   http   html   ref   www   

原文地址:http://www.cnblogs.com/del88/p/6363049.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!