comp.lang.ada
 help / color / mirror / Atom feed
* re: help setting up an array of records
@ 2002-05-26 13:00 Matt Thomas
  2002-05-26 13:18 ` Preben Randhol
  2002-05-26 16:16 ` Matt Thomas
  0 siblings, 2 replies; 13+ messages in thread
From: Matt Thomas @ 2002-05-26 13:00 UTC (permalink / raw)


I posted a few days ago with a problem about setting up an array of records,
thanks for your everyones help on he matter but i still cant get it right.

I dont want the user to enter the values, i want to initialise them in the
code.
I'm trying to do it like this:

PRODUCT(1) := ("Cola        ",4,60,5);

From all I have read up about this should be the way to do it but i can't
get it to compile.
I get the error message: missing ":"
and the (1) is the section that is highlighted.

A few of you asked which textbook I'm using, it is "J. Skansholm, Ada 95
From the Beginning"





^ permalink raw reply	[flat|nested] 13+ messages in thread
* Help setting up an array of records
@ 2002-05-22 15:09 Matt Thomas
  2002-05-22 16:39 ` Stephen Leake
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Matt Thomas @ 2002-05-22 15:09 UTC (permalink / raw)


I know this might be a stupid question to most of you but i have just
started using Ada.

For my uni coursework i have to write a program to simulate a vending
machine.

I'm using an array of records to represent the items in the vending machine
but I dont know how to actually get the information into my array.  I need
to specify the name of the item, its cost and the quantity left.

Here is the record and array declaration, any help would be grateful.

MACHINE_SLOTS  :   constant := 6; --

type PRODUCT_TYPE is
   record
         NAME      :   STRING (1..12);
         LEN       :   POSITIVE;
         PRICE     :   INTEGER;
         QUANTITY  :   INTEGER;
   end record;

type PRODUCT_TYPE_ARR is array (1..MACHINE_SLOTS) of PRODUCT_TYPE;

PRODUCT   :   PRODUCT_TYPE_ARR;





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-05-28 15:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-26 13:00 help setting up an array of records Matt Thomas
2002-05-26 13:18 ` Preben Randhol
2002-05-26 13:24   ` Preben Randhol
2002-05-26 16:10     ` Matt Thomas
2002-05-28 15:01       ` Marin David Condic
2002-05-26 16:16 ` Matt Thomas
2002-05-26 19:53   ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
2002-05-22 15:09 Help " Matt Thomas
2002-05-22 16:39 ` Stephen Leake
2002-05-22 17:18 ` Marin David Condic
2002-05-22 17:32 ` Mark Johnson
2002-05-22 19:15 ` Preben Randhol
2002-05-23  1:58 ` Steve Doiel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox