comp.lang.ada
 help / color / mirror / Atom feed
* question about printing numbers on screen
@ 2001-07-05 22:42 Beau
  2001-07-05 23:50 ` B. Douglas Hilton
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Beau @ 2001-07-05 22:42 UTC (permalink / raw)


How would I print an integer variable on the screen whose number was in the
thousands
say 10000 but have it print like this:

10,000

how would I put in the comma to seperate?
--
~Beau~
beau@hiwaay.net






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about printing numbers on screen
  2001-07-05 22:42 question about printing numbers on screen Beau
@ 2001-07-05 23:50 ` B. Douglas Hilton
  2001-07-06  0:26 ` tmoran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: B. Douglas Hilton @ 2001-07-05 23:50 UTC (permalink / raw)


Use the modulus operation and a switch to format your IO.

- Doug


Beau wrote:

> How would I print an integer variable on the screen whose number was in the
> thousands
> say 10000 but have it print like this:
>
> 10,000
>
> how would I put in the comma to seperate?
> --
> ~Beau~
> beau@hiwaay.net




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about printing numbers on screen
  2001-07-05 22:42 question about printing numbers on screen Beau
  2001-07-05 23:50 ` B. Douglas Hilton
@ 2001-07-06  0:26 ` tmoran
  2001-07-06  2:41 ` wzm
  2001-07-06 21:41 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 5+ messages in thread
From: tmoran @ 2001-07-06  0:26 UTC (permalink / raw)


>say 10000 but have it print like this:
>
>10,000
>
>how would I put in the comma to seperate?
  If your compiler implements Annex F, Information Systems, you can do it
with a "picture string".  If not, you'll have to create an input string
with the value "10000" and build an output string with the commas in the
right places.  It's pretty easy with a "for ... in reverse" loop.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about printing numbers on screen
  2001-07-05 22:42 question about printing numbers on screen Beau
  2001-07-05 23:50 ` B. Douglas Hilton
  2001-07-06  0:26 ` tmoran
@ 2001-07-06  2:41 ` wzm
  2001-07-06 21:41 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 5+ messages in thread
From: wzm @ 2001-07-06  2:41 UTC (permalink / raw)


"Beau" <beau@hiwaay.net> wrote in message news:<tk9rc9cc5cdk6a@corp.supernews.com>...
> How would I print an integer variable on the screen whose number was in the
> thousands
> say 10000 but have it print like this:
> 
> 10,000
> 
> how would I put in the comma to seperate?

I think you should write a subprogram for your own.
It's just easy to process a simple string.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about printing numbers on screen
  2001-07-05 22:42 question about printing numbers on screen Beau
                   ` (2 preceding siblings ...)
  2001-07-06  2:41 ` wzm
@ 2001-07-06 21:41 ` David C. Hoos, Sr.
  3 siblings, 0 replies; 5+ messages in thread
From: David C. Hoos, Sr. @ 2001-07-06 21:41 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: beau, doug.hilton

If your compiler supports Annex F, then you can use
the Edited Output package described in RM95, F.3.

The packages available are Text_IO.Editing,, and
Wide_Text_IO.Editing.  The types of data must be
Decimal types -- i.e., modular types with a 'Small
attribute which is an integer power of 10.


----- Original Message ----- 
From: "Beau" <beau@hiwaay.net>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: July 05, 2001 5:42 PM
Subject: question about printing numbers on screen 


> How would I print an integer variable on the screen whose number was in the
> thousands
> say 10000 but have it print like this:
> 
> 10,000
> 
> how would I put in the comma to seperate?
> --
> ~Beau~
> beau@hiwaay.net
> 
> 
> 
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-07-06 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-05 22:42 question about printing numbers on screen Beau
2001-07-05 23:50 ` B. Douglas Hilton
2001-07-06  0:26 ` tmoran
2001-07-06  2:41 ` wzm
2001-07-06 21:41 ` David C. Hoos, Sr.

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