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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,975b46ec27c036e5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-04 05:56:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Need help for a Calculator program Date: 04 Feb 2002 08:54:09 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1012831125 9261 128.183.220.71 (4 Feb 2002 13:58:45 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 4 Feb 2002 13:58:45 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:19587 Date: 2002-02-04T13:58:45+00:00 List-Id: "Jim" writes: > ive now used "end_of_line" instead of "if operator = '.' then put(result)". > > but what happens now, you can put any character after the expression eg 1 + > 2 + 3f, 1 + 2 + 3z press enter and get the answer. > > if you dont put anything after the last operand it doesnt do anything. This > is because the loop has the check the next character after the last operand > right ? > > how do i make loop exit without it actually reading the next character ? Well, I need to see the code to be sure. I would read an entire line into a string, using Get_Line (Buffer, Buffer_Last). Then go thru the string looking for operators and operands. When you get to the end of the string, you are done. Or you can require the user to enter a semicolon to terminate a statement, like Ada does. That makes things simpler for the programmer, which is ok while you are just learning. -- -- Stephe