From: nasser@apldbio.com (Nasser Abbasi)
Subject: Re: Ada vs C++ for numeric IO (integers)
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00 [thread overview]
Message-ID: <nhn30rxvec.fsf@paralysys> (raw)
In-Reply-To: 31F42BF0.6B62@mich.com
From: Tom Zagotta <tzagotta@mich.com>
Nasser Abbasi wrote:
>
> hi,
>
> I was playing with integer IO to see how C++ and Ada handle it.
> I noticed couple of things, I show the Ada and the C++ examples,
> and have a question on each language.
>
None of the languages I've ever used have provided "bullet-proof" I/O
functions that get user input; I have always written them myself. An example
would be a function with the following signature:
int ReadInteger (const char* Prompt, int Min, int Max)
{
// your code here
}
This function might write out the prompt, read a number from the user, make sure
it's in range, and return the integer when a valid number is typed.
These functions are typically not provided by compiler libraries because of the
uniqueness of your combination of user interface, error handling strategy, etc.
Hope that helps!
Tom Zagotta
Thanks Tom, but that does not really help :)
How are you going to know what the user typed in in the first
place if wrapping will occure for example?
Show me the code that will read in a value for the range for say short int,
and how are you going to detect that the user did not type a value
over that range as their input ?
code, please show me code :)
Nasser
--
Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server application
for Nucleic acid and protein sequence search and analysis.
Perkin Elmer - Applied BioSystem division. email: nasser@apldbio.com
MSEE(control), MSCS, MSCE, FM (Fide Chess Master).
next prev parent reply other threads:[~1996-07-23 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-22 0:00 Ada vs C++ for numeric IO (integers) Nasser Abbasi
1996-07-22 0:00 ` Tom Zagotta
1996-07-22 0:00 ` Robert Dewar
1996-07-23 0:00 ` Nasser Abbasi [this message]
1996-07-24 0:00 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox