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 7 of 19 Topic 189 of 213
Post > Topic >>

Re: Konvalina/Wileman exercises

by "Chris Burrows" <cfbsoftware@[EMAIL PROTECTED] > Apr 24, 2007 at 10:19 PM

"Richard Heathfield" <rjh@[EMAIL PROTECTED]
> wrote in message 
news:Bc2dncCZNdOsdrDbnZ2dnUVZ8tfinZ2d@[EMAIL PROTECTED]
>
> Another six are up now for peer review:
>
> http://www.cpax.org.uk/prg/****table/pascal/pwp/exercises/ch04/index.php
>
> #1 is ugly, no two ways about it. I was determined to use loops, even
> when it meant coming up with the most truly abysmal customised hash
> I've ever seen.

Have 'for' loops been introduced at that stage into the text? If so,
instead 
of:

  v := 0;
  while v < 4 do
  begin
    getvertex(v + 1, x[v], y[v]);
    v := v + 1;
  end;

While this is logically correct, I would prefer:

    for v := 0 to 3 do GetVertex(v + 1, x[v], y[v]);

The rule that I use to determine which type of loop to use goes something 
like this:

Choose the first type of loop that satisfies the requirements from this 
ordered list:

1. If the number of iterations is predetermined before entry into the
loop, 
use a 'for' loop
2. If the statements in the loop are executed zero or more times use a 
'while' loop
3. If the statements in the loop are repeated at least once use a 'repeat'

loop

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
 




 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 Sun Jul 6 2:14:09 CDT 2008.