comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <chris.danx@ntlworld.com>
Subject: Re: How would i keep 'records' in ADA ?
Date: Sun, 10 Mar 2002 12:45:34 -0000
Date: 2002-03-10T12:45:34+00:00	[thread overview]
Message-ID: <yyIi8.12364$xO2.961959@news11-gui.server.ntli.net> (raw)
In-Reply-To: a6e9ko$b6a$1@knossos.btinternet.com


"Jim" <genx54321@hotmail.com> wrote in message
news:a6e9ko$b6a$1@knossos.btinternet.com...
> sorry if i was a little vague.
>
> say i was creating a database type program eg mail order company - which
> holds information such as records of customers :- name, address, tel no.
>
> i will have a menu like this
>
> MENU
>
> a. Add customer details.
> b. Delete customer details.
>
> -----------------
>
> i will have to use arrays and records right ? adding customer details is
> easy.  but deleting, im not sure about.  Do i just replace record for that
> customer with null statements / space character / junk (anything that gets
> rid of the details) or would i have to actually get rid of that element in
> the array ?


For simplicity use arrays (your just learning, right? So why overcomplicate
things with linked lists, SQL etc?  That's just silly).

Do as T(?) Moran suggested and have some kind of unreasonable name (a name
with '-' at the beginning would be funny peculiar so it's a good choice) to
check for.  If it's that name then that record is deleted, or not in use.

use a function like

function is_empty (x : in my_record) return boolean is
begin
   ...
end is_empty;

that will check for this condition.

If you need to save records to a file, you can just walk the array and write
the non-empty items to the file (the type of file depends on the
specification, but a text file is easy to begin with).  Reading them from a
file is easier.


HTH,
Chris





  parent reply	other threads:[~2002-03-10 12:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-09 22:35 How would i keep 'records' in ADA ? Jim
2002-03-09 23:29 ` chris.danx
2002-03-09 23:32   ` chris.danx
2002-03-10  0:33     ` Jim
2002-03-10  2:00       ` tmoran
2002-03-10  6:51       ` Jeffrey Carter
2002-03-10 12:14       ` rmoldskr
2002-03-11 15:33         ` Marin David Condic
2002-03-10 12:45       ` chris.danx [this message]
2002-03-11 15:39         ` Marin David Condic
2002-03-10 12:03 ` David C. Hoos, Sr.
replies disabled

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