From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 6 Nov 92 03:54:29 GMT From: seas.gwu.edu!mfeldman@uunet.uu.net (Michael Feldman) Subject: Re: DATA_ERROR exception problem Message-ID: <1992Nov6.035429.3410@seas.gwu.edu> List-Id: In article eachus@oddjob.mitre.org (Robe rt I. Eachus) writes: > > The proper solution is to call Skip_Line after each call to Get, >unless your user interface specification permits more than one integer >value per line. In that case you can either do a Skip_Line on error, >or read into a String, and parse "by hand" when invalid input is >encountered. (I really suggest in any case throwing the queued input >away when an error is encountered, but especially in an introductory >class!) > Yep. That's how most of us teach it. Interestingly, many students - even freshmen - want to know if there's a better way, so that input data can be "batched" on a line. If they've studied strings yet, I tell them about the "read it into a string" solution, let 'em know it's possible, and go back to the Skip_Line thing. Mike Feldman ------------------------------------------------------------------------ Michael B. Feldman co-chair, SIGAda Education Committee Professor, Dept. of Electrical Engineering and Computer Science School of Engineering and Applied Science The George Washington University Washington, DC 20052 USA (202) 994-5253 (voice) (202) 994-5296 (fax) mfeldman@seas.gwu.edu (Internet) "Americans wants the fruits of patience -- and they want them now." ------------------------------------------------------------------------