Turtle Graphics?

In the book we're using, C++ How to Program Deitel & Deitel, our professor wants us to work on some of the exercises in the array chapter (that's chapter four). Some of the things just confuse me. For example, the turtle graphics. There are several commands, pen up, pen down, etc... but wouldn't you be better off using a case instead of an array in this case? I guess I'm just confused by some of the logic.

I can understand it when I read it, but when it comes to assembling it... Seems a little more difficult. Any good books on C++ programming logic out there?

Comments

  • : In the book we're using, C++ How to Program Deitel & Deitel, our professor wants us to work on some of the exercises in the array chapter (that's chapter four). Some of the things just confuse me. For example, the turtle graphics. There are several commands, pen up, pen down, etc... but wouldn't you be better off using a case instead of an array in this case? I guess I'm just confused by some of the logic.
    :
    : I can understand it when I read it, but when it comes to assembling it... Seems a little more difficult. Any good books on C++ programming logic out there?
    :

    You may be correct or you may be wrong. The best thing to do is to ask your professor.

    One reason they may have implemented an array rather than a switch case structure may be due to the planned usage of the code in the future. Many beginner programmers design code to solve a solution now without any though for how the code my be used in the future. Thus the implementation of an array may not seem like a good solution, but it may be more usefull down the road.

    It may also be that it is infact a bad implementation and they just wanted to show how an array may be used.

    As far as books on ligic of programming, I think it is just learned by practice, experience and understanding the computer architecture, compilers and assemblers. You are learning logic.

    PS I belive the "Turtle Graphics" is based on an old programming languge call Logo. In this language, you programmed a cursor called a turtle, and you told it thing like Penup pendown, rt 90 lt90 fd100. Which stand for right 90 degrees left 90 degrees and foward 100 pixels.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion