[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ADA Help



Jenei Gábor wrote:
Hello!

Could anyone help me?I'm just trying to make an ADA program,

For general help on the Ada language, it is better to ask on the USENET
newsgroup comp.lang.ada.

By the way, the name of the language is spelled "Ada". It is not an
acronym, so don't write it in all-caps.

but the excercise seems to be to store variant records in an Array.Is
it Possible?

Yes, but the discriminant must have a default value, for example as in

   type Rocket_Type (Liquid_Fuel : Boolean := False) is
   record...end record;

Actually the memebers of my record depend on the discriminant(if
discriminant is true then I have one more member,otherwise only 3
members).Any idea to do this?

   type Rocket_Type (Liquid_Fuel : Boolean := False) is record
      (declare some components that do not depend on the discriminant)
      case Liquid_Fuel is
      when False =>
         (declare some components for rockets with non-liquid fuels)
      when True =>
         (declare some components for rockets with liquid fuels)
      when ...
      end case;
   end record;

I also have to do this inside a package where I define functions and
procedures in connection with this.I have no idea,please help!

Read a book about Ada, for example the Wikibook at
http://en.wikibooks.org/wiki/Ada_Programming.

HTH,

Niklas Holsti
Tidorum Ltd


Reply to: