comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@bton.ac.uk>
Subject: Re: Ada'83 to Ada'95 Problem
Date: Thu, 01 Mar 2001 14:27:37 +0000
Date: 2001-03-01T14:27:28+00:00	[thread overview]
Message-ID: <3A9E5C59.1EF8A793@bton.ac.uk> (raw)
In-Reply-To: 3A9E35F3.EE64F602@port.ac.uk

dis00109 wrote:
> 
> I am trying to get a program to accept two integers as input by the user
> (for a university project) however in the exception handling section of
> my program it will not accept a float input as an error it merely
> ignores everything after the decimal point. This would appear to be a
> new feature in Ada'95, can anyone think of a way to solve this...PLEASE!

???

If you do this:
   Get(A); Get(B);
and you enter 3.14, you'll get a Data_Error at the point where "."
is read (the point where the point is read? ;-)  The first Get will
read an integer (3) and then stop at the first non-integer character
("."); the second Get will start at "." and go "ugh! that's not an
integer" and bail out with a Data_Error without reading anything.

If on the other hand you do this:
   Get(A); Skip_Line;
   Get(B); Skip_Line;
you'll get exactly the effect you've described; the first Get reads
an integer, and stops at the first non-integer character ("."), and
Skip_Line then throws the rest of that line away (".14" in this case).
The second Get will then read whatever is on the next line in the
same way.

Is this what you've done, perhaps?

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



  parent reply	other threads:[~2001-03-01 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-01 11:43 Ada'83 to Ada'95 Problem dis00109
2001-03-01 14:19 ` Marin David Condic
2001-03-01 14:27 ` John English [this message]
2001-03-01 18:23 ` Ted Dennison
2001-03-01 19:29 ` Singlespeeder
2001-03-02 16:03 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2001-03-01 17:39 Beard, Frank
2001-03-05 13:51 ` John English
replies disabled

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