comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: Where'd the PAL go?
Date: 1999/03/31
Date: 1999-03-31T00:00:00+00:00	[thread overview]
Message-ID: <7dtq58$989$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 3701C1A0.F6956956@wvu.edu

In article <3701C1A0.F6956956@wvu.edu>,
  Mike Werner <mwerner@wvu.edu> wrote:
> Matthew Heaney wrote:

> > Were the things you found easier to do in C than in Ada?  There may be a
> > simpler but non-obvious way to do it in Ada.
>
> Actually, one thing about C that I prefered over the Ada version was the
> IO statements - i.e. put and get.  I like being able to put the entire
> thing on one line, text and variables and the line feed.  If there's an
> Ada equivalent I'd love to know about it.  If not, perhaps I'll create

Sure. Just use Put_Line, and the 'image attribute on any numeric values. "&"
can be used to tack strings together. eg:

   for Loop_Count in 1..5 loop
      Text_IO.Put_Line ("We have executed" & Integer'image(Loop_Count) &
         " loop(s).");
   end loop;


should produce:

We have executed 1 loop(s).
We have executed 2 loop(s).
We have executed 3 loop(s).
We have executed 4 loop(s).
We have executed 5 loop(s).


Admittedly this doesn't give you the powerful formatting capabilities that
are available in C's printf. But the cool thing is that the same string can
be used in an assignment statement as well. You can also pass it to other
routines for further processing. Combine that with the routines in the
Ada.Strings packages, and I think Ada's string handling is actually more
powerful and more convienent than C's.

T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-03-31  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-29  0:00 Where'd the PAL go? Mike Werner
1999-03-29  0:00 ` Matthew Heaney
1999-03-29  0:00   ` dennison
1999-03-31  0:00   ` Mike Werner
1999-03-31  0:00     ` dennison [this message]
1999-04-02  0:00       ` Mike Werner
replies disabled

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