From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf3a056f36b4078f X-Google-Attributes: gid103376,public From: Tom Zagotta Subject: Re: Ada vs C++ for numeric IO (integers) Date: 1996/07/22 Message-ID: <31F42BF0.6B62@mich.com>#1/1 X-Deja-AN: 170264517 references: content-type: text/plain; charset=us-ascii organization: mich.com, Inc., Farmington, Michigan mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.02Gold (Win95; I) Date: 1996-07-22T00:00:00+00:00 List-Id: 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. > { snip } > -- > 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). 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