comp.lang.ada
 help / color / mirror / Atom feed
* Exit using Return Key
@ 2004-01-05 23:39 mcslemon
  2004-01-06  0:04 ` Stephen Leake
  0 siblings, 1 reply; 2+ messages in thread
From: mcslemon @ 2004-01-05 23:39 UTC (permalink / raw)


Help!

Doing an assignment and have nearly finished, but have come to a
problem!

I'm using get(conv) to read input from the keyboard....this is fine,
but CONV is assigned to a type, so can't vary from the type.

The person can either enter a phrase to continue, or hit enter to exit
the program.

Is there a way of reading the line length or something so if they type
the phrase it continues or exits on return key hit.

Starts using:

  type Measurement is (Ins,Mil,Cm,Km,Lbs,Kg);
  package measurement_inout is new enumeration_io(measurement);
  subtype Distance is Measurement range Ins..Km;
  subtype Weight is Measurement range Lbs..Kg;
  use measurement_inout;
  Conv : Measurement;
..

..

..

loop
     New_Line;

       Put("Please Enter Unit to Convert From");
        New_Line;

        Get(Conv);

reads the CONV there...

Any ideas!

Neil.



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

* Re: Exit using Return Key
  2004-01-05 23:39 Exit using Return Key mcslemon
@ 2004-01-06  0:04 ` Stephen Leake
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Leake @ 2004-01-06  0:04 UTC (permalink / raw)
  To: comp.lang.ada

mcslemon@hotmail.com (mcslemon) writes:

> Doing an assignment and have nearly finished, but have come to a
> problem!

Ok.

> loop
>      New_Line;
> 
>        Put("Please Enter Unit to Convert From");
>         New_Line;

Use Get_Line to read into a string. Then either exit, or get Conv from
the string.

Details are left as an exercise :).



-- 
-- Stephe




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

end of thread, other threads:[~2004-01-06  0:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-05 23:39 Exit using Return Key mcslemon
2004-01-06  0:04 ` Stephen Leake

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