* newbie: fixed_text_io and decimals
@ 2004-03-21 2:47 Lee Jun Wei
2004-03-21 13:28 ` Stephen Leake
2004-03-22 16:04 ` jdpetrey<NO_SPAM>
0 siblings, 2 replies; 4+ messages in thread
From: Lee Jun Wei @ 2004-03-21 2:47 UTC (permalink / raw)
Hello, I have just started picking up Ada by myself 3 days ago
(background in C++,VB,learning Java and PHP currently as well).
I read a few tutorials and they pointed that you could use
Ada.Fixed_Text_IO to Put() and Get() values, but somehow ObjectAda and
GNAT both complained they don't exist.
My data type is: type decimal is delta 0.01 range 0.00 .. 9999.00;
My header:
with ada.text_io,ada.integer_text_io,ada.float_text_io,ada.fixed_text_Io;
use ada.text_io,ada.integer_text_io,ada.float_text_io,ada.fixed_text_io;
Could someone help out? Thanks in advance.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: newbie: fixed_text_io and decimals
2004-03-21 2:47 newbie: fixed_text_io and decimals Lee Jun Wei
@ 2004-03-21 13:28 ` Stephen Leake
2004-03-22 16:04 ` jdpetrey<NO_SPAM>
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Leake @ 2004-03-21 13:28 UTC (permalink / raw)
To: comp.lang.ada
nexus@nexus.webhour.net (Lee Jun Wei) writes:
> Hello, I have just started picking up Ada by myself 3 days ago
> (background in C++,VB,learning Java and PHP currently as well).
>
> I read a few tutorials and they pointed that you could use
> Ada.Fixed_Text_IO to Put() and Get() values, but somehow ObjectAda and
> GNAT both complained they don't exist.
>
> My data type is: type decimal is delta 0.01 range 0.00 .. 9999.00;
with Ada.Text_Io;
procedure Example
is
type decimal is delta 0.01 range 0.00 .. 9999.00;
package Decimal_Text_IO is new Ada.Text_Io.Fixed_Io (Decimal);
A : constant Decimal := 10.2;
begin
Ada.Text_Io.Put ("A is :");
Decimal_Text_IO.Put (A);
Ada.Text_Io.New_Line;
end Example;
--
-- Stephe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: newbie: fixed_text_io and decimals
2004-03-21 2:47 newbie: fixed_text_io and decimals Lee Jun Wei
2004-03-21 13:28 ` Stephen Leake
@ 2004-03-22 16:04 ` jdpetrey<NO_SPAM>
2004-03-24 18:02 ` Lee Jun Wei
1 sibling, 1 reply; 4+ messages in thread
From: jdpetrey<NO_SPAM> @ 2004-03-22 16:04 UTC (permalink / raw)
There is no standard fixed type so you need to instantiate a version of
Fixed_Io for your type. Try adding:
package Decimal_IO is new Ada.Text_Io.Fixed_Io(Decimal); use Decimal_Io;
after your type definition and then you can Put and Get those type values.
(get rid of the with ada.fixed_text_Io)
Jerry
Lee Jun Wei wrote:
> Hello, I have just started picking up Ada by myself 3 days ago
> (background in C++,VB,learning Java and PHP currently as well).
>
> I read a few tutorials and they pointed that you could use
> Ada.Fixed_Text_IO to Put() and Get() values, but somehow ObjectAda and
> GNAT both complained they don't exist.
>
> My data type is: type decimal is delta 0.01 range 0.00 .. 9999.00;
>
> My header:
> with ada.text_io,ada.integer_text_io,ada.float_text_io,ada.fixed_text_Io;
> use ada.text_io,ada.integer_text_io,ada.float_text_io,ada.fixed_text_io;
>
> Could someone help out? Thanks in advance.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: newbie: fixed_text_io and decimals
2004-03-22 16:04 ` jdpetrey<NO_SPAM>
@ 2004-03-24 18:02 ` Lee Jun Wei
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jun Wei @ 2004-03-24 18:02 UTC (permalink / raw)
"jdpetrey<NO_SPAM>" <"jdpetrey<NO_SPAM>"@raytheon.com> wrote in message news:<08E7c.1$6D5.0@dfw-service2.ext.ray.com>...
> There is no standard fixed type so you need to instantiate a version of
> Fixed_Io for your type. Try adding:
>
> package Decimal_IO is new Ada.Text_Io.Fixed_Io(Decimal); use Decimal_Io;
>
> after your type definition and then you can Put and Get those type values.
> (get rid of the with ada.fixed_text_Io)
>
> Jerry
>
>
Thanks Jerry and Stephe. I was looking through my tutorials agains
(Lovelace's among others and found it in one of the examples as well.)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-03-24 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-21 2:47 newbie: fixed_text_io and decimals Lee Jun Wei
2004-03-21 13:28 ` Stephen Leake
2004-03-22 16:04 ` jdpetrey<NO_SPAM>
2004-03-24 18:02 ` Lee Jun Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox