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: nasser@apldbio.com (Nasser Abbasi) Subject: Re: Ada vs C++ for numeric IO (integers) Date: 1996/07/23 Message-ID: #1/1 X-Deja-AN: 169622415 sender: news@biosys.apldbio.COM references: <31F42BF0.6B62@mich.com> original-sender: nasser@apldbio.com organization: Applied BioSystems newsgroups: comp.lang.ada Date: 1996-07-23T00:00:00+00:00 List-Id: From: Tom Zagotta 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).