comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: integers into strings
Date: Thu, 02 Feb 2006 19:32:54 GMT
Date: 2006-02-02T19:32:54+00:00	[thread overview]
Message-ID: <G7tEf.4394$5E3.2333@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <1138851785.180604.32910@g47g2000cwa.googlegroups.com>

isaac2004 wrote:

> no im not converting the inputted number into a string im sorting the
> digits of the value into ascending and descending order and then making
> two different numbers out of it one ascending one descending

I suppose you could pull off the digits using "rem" and "/", sort those, and put 
them back together using "*" and "+", but it seems easier to deal with the 
numbers as Strings and the digits as Characters.

In any case, you're going to input the number as Characters. You may hide this 
by using something like Ada.Text_IO.Integer_IO, but the actual input is a 
sequence of characters, which is then interpreted as the image of a value of an 
integer type and converted to the corresponding value. That's why it's called 
"Text I/O". If you do decide to do the sorting with Characters, you can make 
things a little easier by simply inputting the number as a String.

-- 
Jeff Carter
"I would never want to belong to any club that
would have someone like me for a member."
Annie Hall
41



      parent reply	other threads:[~2006-02-02 19:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02  1:38 integers into strings isaac_2004
2006-02-02  2:15 ` Jeffrey R. Carter
2006-02-02  3:43   ` isaac2004
2006-02-02  5:48     ` Simon Wright
2006-02-02 19:32     ` Jeffrey R. Carter [this message]
replies disabled

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