From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f12483752dbc412b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-09 18:01:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr14.news.prodigy.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: How would i keep 'records' in ADA ? References: X-Newsreader: Tom's custom newsreader Message-ID: <%6zi8.1520$rq2.1125284992@newssvr14.news.prodigy.com> NNTP-Posting-Host: 67.112.203.111 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr14.news.prodigy.com 1015725627 ST000 67.112.203.111 (Sat, 09 Mar 2002 21:00:27 EST) NNTP-Posting-Date: Sat, 09 Mar 2002 21:00:27 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: OH\IRYOGTRUSP_@YMZJ\_Q\@TJ_ZTB\MV@BNMRQIMASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN Date: Sun, 10 Mar 2002 02:00:27 GMT Xref: archiver1.google.com comp.lang.ada:21002 Date: 2002-03-10T02:00:27+00:00 List-Id: >holds information such as records of customers :- name, address, tel no. >... >i will have to use arrays and records right ? adding customer details is The information for one customer is heterogeneous - name string, phone number, etc, so a record is appropriate. The set of customers is homogeneous - all customers are equivalent, so an array is appropriate. If you want to save the data from one run of the program to another you'll need to write the array of records to a file when the program stops, and read back in next time the program starts. >but deleting, im not sure about. Do i just replace record for that >customer with null statements / space character / junk The easiest is to just mark that customer record somehow as "empty". Perhaps something as simple as changing the first character in the customer's name to '-'. Then periodically copy the database, except for the "empty" records, to squeeze out the "bubbles". That gets a bit painful if the database is very large, however. Then you might use an available-space list: Keep track of the first record number (index into the array of customer records) that is "empty". Make a field in that empty record contain the record number of the next empty record, and so on. When it's time to add a new customer, put him in the first empty record, and set the First_Empty_Record variable to point to the next empty slot. This is the sort of stuff it's a whole lot quicker to learn from a teacher or a book, than to re-invent by yourself. >would i have to actually get rid of that element in the array ? If an array is a series of contiguous bits, you can't actually get rid of an element (short of pulling out memory chips). You can only mark it in some way, or you can create a new array based on the old array.