type dept=(house, sports, drugs, food, liquor) month=1.12 item=record price: real case available: boolean of true: (amount: integer Where: dept) false: (month expected month) enc d
type dept=(house,sports,drugs,food,liquor); month=1..12; item=record price:real; case available:boolean of true:(amount:integer; where:dept); false:(month_expected:month) end;
var il12 item il price: =5. 24 il available =true amount =29 il. where: - liquor 12 price-=324.99; 12. available =false 12. month expect: =8
var i1,i2:item: …… i1.price:=5.24; i1.available:=true; i1.amount:=29; i1.where:=liquor; i2.price:=324.99; i2.available:=false; i2.month_expect:=8;
price 5.24 pce324.99 avallable avallable false amount 29 month_expected q uor where
price available amount where 5.24 true 29 liquor price available month_expected 324.99 false 8
组合类型 1.数组 ①约束数组类型 下标界是静态确定的 type MONTH IS JAN,FEB, MAR,APR, MAY,JUN JUL, AUG, SEP,OCT,NOVDEC) type YEARLY PAY is array(MONTH)of INTEGER type SUMMer PAY is array(MONTH range JUL SEP)of INTEGER
二. 组合类型 1. 数组 ①约束数组类型 ⎯下标界是静态确定的 type MONTH is (JAN,FEB,MAR,APR,MAY,JUN, JUL,AUG,SEP,OCT,NOV,DEC); type YEARLY_PAY is array(MONTH) of INTEGER; type SUMMER_PAY is array(MONTH range JUL..SEP) of INTEGER;
②非约束数组类型 Ada支持动态数组 type SoMe PERIOd PAY ia array MONTH range< >)of INTEGER type INT VERTOR ia array(INTEGER range <> of Integer type BOOL MAXTRIX iS array(INTEGER range INTEGER range <>)of BOOLEAN ③Ada数组类型由分量的类型下标个数 和下标类型来刻画
②非约束数组类型 ⎯Ada支持动态数组 type SOME_PERIOD_PAY ia array(MONTH range< >) of INTEGER; type INT_VERTOR ia array(INTEGER range < >) of INTEGER; type BOOL_MAXTRIX is array(INTEGER range < >, INTEGER range < >) of BOOLEAN; ③Ada数组类型由分量的类型,下标个数 和下标类型来刻画