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: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Ada vs C++ for numeric IO (integers) Date: 1996/07/22 Message-ID: #1/1 X-Deja-AN: 169789248 references: <31F42BF0.6B62@mich.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-07-22T00:00:00+00:00 List-Id: Tom Zagotta said: 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. I don't see how that is different from what you would get in Ada from: type Input_Integer is range Min .. Max; package My_Input is new Ada.Text_IO.Integer_IO (Input_Integer); ... Put_Line (Prompt); My_Input.Get (My_Input_Integer); -- My_Input_Integer is type Input_Integer then if you want to trap invalid input, catch the exception Data_Error.