comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <chris.danx@ntlworld.com>
Subject: Re: Some general help with Ada
Date: Sat, 9 Mar 2002 19:46:38 -0000
Date: 2002-03-09T19:46:38+00:00	[thread overview]
Message-ID: <kDti8.3523$y76.752306@news6-win.server.ntlworld.com> (raw)
In-Reply-To: ab6237e2.0203091102.103d54e9@posting.google.com


"Jim" <genx54321@hotmail.com> wrote in message
news:ab6237e2.0203091102.103d54e9@posting.google.com...
> how do you create a blank screen like the CLS command in Qbasic/DOS ?
>
> can you do it with text_io ?

ada.text_io.new_line (26); is quick and easy.

> also how do i remove 'rows' in an array ?  eg if an array is made up
> of 0..100, i add data into say 1, 2 and 3.  How do i then delete 1,2,3
> and be left with 4..100 ? is that possible ?

You want to slice the array something like this?

WARNING: uncompiled code following

type my_array is (natural range <>) of some_type;

subtype my_other_array is my_array (range 0..100);

function get_relevant_data (a : in my_other_array) return my_array is
begin
   return a(4..a'last);
end get_relevant_data;

the line return a(4..a'last) will return the elements between 4 and the end
of the array (100 in this case).  It is important that my_other_array is a
subtype of my_array since otherwise they'd be of different types and Ada
doesn't allow mixing types in an arbitary fashion.  John English covers
arrays in his (now online and free) book available at
www.it.bton.ac.uk/staff/je/adacraft/ in case your interested.

HTH,
Chris





  reply	other threads:[~2002-03-09 19:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-09 19:02 Some general help with ADA Jim
2002-03-09 19:46 ` chris.danx [this message]
2002-03-10  0:57   ` Some general help with Ada David Starner
2002-04-08  0:43     ` Nick Roberts
2002-03-09 20:13 ` Some general help with ADA Adrian Knoth
replies disabled

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