Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: Konvalina/W...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 19 Topic 189 of 215
Post > Topic >>

Re: Konvalina/Wileman exercises

by Richard Heathfield <rjh@[EMAIL PROTECTED] > Apr 23, 2007 at 08:57 PM

CBFalconer said:

> Richard Heathfield wrote:
>> 
<snip>
>> 
>> Since my home unaccountably lacks a resident Pascal expert, I
>> would appreciate feedback on whether these are good answers.
>> 
>> All eleven of them may be found here:
>> 
>> 
http://www.cpax.org.uk/prg/****table/pascal/pwp/exercises/ch03/index.php
> 
> ex08 is a mistake.  The standard procedure write(real : field :
> precision) covers the complete mechanism.  You want precision = 2
> here.

Um, this "mistake" is the spec, Chuck. I understand what you're saying, 
but I think this is one of those silly exercises along the same lines 
as "write a macro to find the size of an object without using sizeof" 
or "write a sorty thing without using qsort". I didn't choose the 
exercise. I merely solved it.

>  * The single input data line contains a real number r and an
>  * integer p. Note that p indicates the position of the digit at
>  * which r is to be rounded, relative to the units column (so 1
>  * means round to nearest 10, 2 means round to nearest hundred, -1
>  * means round to nearest hundredth, etc).
> 
> This is out and out wrong.

It's the spec! How can it possibly be wrong? :-)

(Let me count the ways...)

Seriously, it seems to me that the problem is well-defined and 
meaningful. The fact that Pascal has a different mechanism for 
achieving the same goal is of little im****t, surely?

> Apart from that, on a quick scan, I see
> nothing wrong.

Delighted to hear it, but I am concerned at the apparent lack of 
robustness of read and readln. For example, I tried running ex08 and 
giving an input of 'frog', and got this output:

Runtime error 106 at $080480E4
  $080480E4
  $0804809F

If this were C, I'd have added a lot more validation, but I don't quite 
see how to do that with readln - at least, not yet.

-- 
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 




 19 Posts in Topic:
Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-23 13:49:56 
Re: Konvalina/Wileman exercises
scott moore <nospam@[E  2007-04-23 09:37:19 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-23 15:14:56 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-23 20:57:34 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-23 19:57:30 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-24 11:36:06 
Re: Konvalina/Wileman exercises
"Chris Burrows"  2007-04-24 22:19:26 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-24 13:59:58 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-24 14:38:35 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-24 21:49:47 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-24 18:58:17 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-25 06:03:14 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-25 09:01:10 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-25 13:47:57 
Re: Konvalina/Wileman exercises
CBFalconer <cbfalconer  2007-04-25 11:03:27 
Re: Konvalina/Wileman exercises
Richard Heathfield <rj  2007-04-25 16:57:07 
IsLeapYear (was: Konvalina/Wileman exercises)
"Chris Burrows"  2007-04-25 09:05:24 
Re: IsLeapYear (was: Konvalina/Wileman exercises)
CBFalconer <cbfalconer  2007-04-24 20:14:39 
Re: IsLeapYear (was: Konvalina/Wileman exercises)
Richard Heathfield <rj  2007-04-25 06:12:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:23:37 CDT 2008.