Re: [CS3304_1381] Question about Pascal

New Message Reply About this list Date view Thread view Subject view Author view

Stephen Edwards (edwards@CS.VT.EDU)
Mon, 14 Feb 2000 09:23:38 -0500


Message-ID:  <38A80FEA.7AA782F7@cs.vt.edu>
Date:         Mon, 14 Feb 2000 09:23:38 -0500
From: Stephen Edwards <edwards@CS.VT.EDU>
Subject:      Re: [CS3304_1381] Question about Pascal

> I forgot what the output format is.

The assignment requests that either the evaluated value,
such as:

-15

or

1/120 = 0.0083

be printed out for legitimate expressions, and the correct
error message for invalid expressions.

If you wish to also echo the input expression (which is
optional, not required, but makes looking at collected
output much easier), I would suggest separating the
input expression from the generated output by some
visible marker, like this:

1 * (2 + 3) => 5
1*2 2 => Incorrect expression syntax.

Choose a marker that isn't legal in expressions,
like " => " above.

If you choose white space as a separator between the
echoed expression and the answer, it may make reading
the output more difficult. That is because white space is
perfectly legitimate to include in expressions. For
example, suppose your program produces the following
output:

1*2 2

How will you know what part is the echoed expression
and what part (if any) is the calculated output? In this
case, your program might have read in "1*2" and calculated
its value correctly. Alternatively, it might have read
in "1*2 2" and failed to print out the correct error message.
From the output alone, it is hard to tell. Using more white
space doesn't solve the problem:

1*2 2

The above line could have actually been an (erroneous)
input line, so the same ambiguities arise.

                                -- Steve

--
Stephen Edwards            641 McBryde Hall          Dept. of Computer Science
e-mail      : edwards@cs.vt.edu           U.S. mail: Virginia Tech (VPI&SU)
office phone: (540)-231-5723                         Blacksburg, VA  24061-0106
-------------------------------------------------------------------------------


New Message Reply About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Mon Feb 14 2000 - 09:24:27 EST