Thread: Two Demensional Arrays

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    2

    Two Demensional Arrays

    Greetings,

    I am not asking for anyone to do this work for me (unless they want to then it would be apreaciated) but my programming teacher fails to teach us properly, I have mainly taught myself though C++ tutorials on the web. He assigned us this project were we have to make a "turtle" move on a grid and show the path where it walks. He has not taught us some of statements required for the project. So I ask if someone can help me out and give me some pointers to help get it going.

    I have uploaded the project.

    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    I don't think any graphics are required -- the instructions don't ask you to draw the shape(s) in graphics, only to keep track of the pen in the 2d array, then print in text mode using either spaces or x's where the tuttle has gone. You will want to use an x and y integers to keep track of the turtle movements within the 2d array, and change the array's value from 0 to 1 in each array element that the turtle passes through. For example, the turtle begings in element where x = 0 and y = 0; If the first move command with the pen down is 5,11 (move 11 spaces), then the tutle will move from x = 0 to x = 10 (that is 11 spaces), so change all elements between array[0][0] and array[0][10] from 0 to 1.

    You also have to keep in mind the direction of the turtle. Command 3 is probably "Turn Right" instead of "Pen Right" as shown in the document. So if the previous command had been 3, then the command 5,11 would move the turtle down instead of to the right, so change the elements from array[0][0] to array[10][0] from value 0 to 1.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by C++ help
    but my programming teacher fails to teach us properly
    What you really mean is that you don't want to read your textbook and do the questions at the end of each chapter. If you do that, then you can ask your teacher questions about things you don't understand.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    He has not taught us some of statements required for the project.
    How do you know this if you don't know what statements are required? Kind of a circular argument there eh?

    This program does not require any special statements. Simple 2D array access, simple keyboard input, and simple printing statements so you can print the array on the screen are all that is needed.

    You should be able to do this.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    2
    Thank you for helping, as for my teacher when I say he failed to teach us I mean like he does not come around and help us, he assigned this project and did not tell us how to do it what so ever. No we do not have textbooks we just do all our work on the computers while he showed us demo's of how some of the programs work. His poor teaching methods make us students suffer and hurt our marks.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    No we do not have textbooks
    Well, did you ever consider buying one? They are sort of like a book of magic: if you read a good one, you can cast spells on your computer to make it do what you want.

  7. #7
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Are you taking a college course, or are you in high school? You teacher may not explain a whole lot because (s)he wants you to think on your own. Afterall, that is half the programmer's job -- when you get a job nobody is going to explain every little detail to you, its your job to fingure out how to write the program.

  8. #8
    Registered User
    Join Date
    Oct 2005
    Posts
    26
    High school C++/programming teachers are generally the worst at teaching you. They'll just give you a 30 page packet and expect you to understand it completely. *remembers 9th grade*

  9. #9
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    High school computer teachers, in my experience, don't teach you much of anything. Usually they know the internet well enough to know that anything they want to teach you could be taugh to you better by some tutorial or book they know of. So what you end up getting is a teacher that sends you off to read the documentation of some compiler, an ebook on OOP, notes from this site, a tutorial from here. Pretty much the only purpose to the teacher then is supervision, making sure you're actually studying, telling you what you need to learn, and giving a test every once and a while.

    I know that my computer teacher now knows this, because she got angry when she found out most of my class didnt have prereqs for the course, and why would she want those? because people who have the prereqs can generally learn online and not require a teacher, whereas the ones without it actually require being teached.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  10. #10
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by Dae
    High school computer teachers, in my experience, don't teach you much of anything. Usually they know the internet well enough to know that anything they want to teach you could be taugh to you better by some tutorial or book they know of. So what you end up getting is a teacher that sends you off to read the documentation of some compiler, an ebook on OOP, notes from this site, a tutorial from here. Pretty much the only purpose to the teacher then is supervision, making sure you're actually studying, telling you what you need to learn, and giving a test every once and a while.
    well considering your high-school computer teacher is not a computer professional (and being paid a fraction of what a pro language trainer gets) what do you expect? computer teachers in high school are generally maths/physics teachers who are saddled with teaching a bunch of ignorant little oiks who expect to program quake 5 in 20 lines of basic. Considering most of them have next to no budget for books, compilers, etc., it's difficult to expect them to be Herb Sutter/Scott Meyers/insert-your-own-C++-guru....

    Hell a lot of the teachers I know help out on their own time and are basically trying to learn one step ahead of the class.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 04:24 PM
  2. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  3. Dynamic (Numeric) Arrays
    By DavidB in forum C++ Programming
    Replies: 5
    Last Post: 05-03-2006, 07:34 PM
  4. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 10:47 PM
  5. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM