Simple Data types
//creates three variables for TEMPERATURE which is of type float
type TEMPERATURE is new float; ta, tb, tc: TEMPERATURE;
//creates three variables for PRESSURE which is of type float
type PRESSURE is new float; pa, pb, pc: PRESSURE;
ta=pa is illegal as it is implicit type conversion
ta= TEMPERATURE(pa); is legal
//creates range between o to 10000
type HEIGHT is new float range 0..100000;
Sub types
type TIME is new float range 0..23.59; subtype MORNING is TIME range 0..11.59; subtype NOON is TIME range 12..16.00; subtype EVENING is TIME range 16.01..18.59
Enumeration type
MONTH is (jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec);
floating point
type var1 is digits 8 range -1e20..1e20;
type var2 is digits 12 range -1e20..1e20;
fixed point
type var3 is delta 0.001 range 0.000..0.999;
Arrays
//SMALLINT is a array variable can have the range between 0 and 20, 10 such variables are declared
type SMALLINT is integer range 0..20;
type VAR4 is array(1..10) of SMALLINT;
//creates three variables for TEMPERATURE which is of type float
type TEMPERATURE is new float; ta, tb, tc: TEMPERATURE;
//creates three variables for PRESSURE which is of type float
type PRESSURE is new float; pa, pb, pc: PRESSURE;
ta=pa is illegal as it is implicit type conversion
ta= TEMPERATURE(pa); is legal
//creates range between o to 10000
type HEIGHT is new float range 0..100000;
Sub types
type TIME is new float range 0..23.59; subtype MORNING is TIME range 0..11.59; subtype NOON is TIME range 12..16.00; subtype EVENING is TIME range 16.01..18.59
Enumeration type
MONTH is (jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec);
floating point
type var1 is digits 8 range -1e20..1e20;
type var2 is digits 12 range -1e20..1e20;
fixed point
type var3 is delta 0.001 range 0.000..0.999;
Arrays
//SMALLINT is a array variable can have the range between 0 and 20, 10 such variables are declared
type SMALLINT is integer range 0..20;
type VAR4 is array(1..10) of SMALLINT;
Sir ,thank you very much for the information about ADA real time programming language.It was very much helpful.
ReplyDelete