Thread: Tortoise and Hare Assignment

  1. #16
    Registered User
    Join Date
    Oct 2015
    Posts
    28
    Well, let's remember that we're adding values greater than 1 in certain conditions, to hare and tortoise. For this reason, the tests 'tortoise != finish' and 'hare != finish' are inadequate, 'tortoise < finish' and 'hare < finish' would be much better choices here.

    I think if you try rewriting your source code (with extra care taken with formatting), you will write it a bit more cleanly the second time around and fix a few bugs along the way.

    Another good thing is to read carefully through your source code and think "why do I need this statement? could it be simplified? if I removed it, how would it affect the program? etc." These are the things that will help you get better at programming, it's not so much writing the source code that gets you better, but reading and rewriting.

  2. #17
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Also posted here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tortoise and Hare Race
    By leejhadee in forum C Programming
    Replies: 1
    Last Post: 09-09-2014, 05:59 AM
  2. The hare and the tortoise
    By Messi 10 in forum C Programming
    Replies: 3
    Last Post: 12-08-2012, 08:56 AM
  3. Tortoise and Hare Project
    By fenixataris182 in forum C++ Programming
    Replies: 5
    Last Post: 07-21-2005, 12:05 PM
  4. Tortoise/Hare clock question
    By curlious in forum C++ Programming
    Replies: 8
    Last Post: 08-22-2003, 01:44 PM
  5. Tortoise and the Hare
    By ghettoman in forum C++ Programming
    Replies: 1
    Last Post: 09-27-2001, 01:26 PM