Thread: Help with 3D arrays?!

  1. #1
    Registered User pinkgirl's Avatar
    Join Date
    Nov 2011
    Posts
    1

    Unhappy Help with 3D arrays?!

    Hi, I'm trying to make an array for my class but I just can't get through it .
    I am supposed to ask for the position in the array and put a 0 in there by itself, cycle the process until the user writes 'x'. If the position has already been filled, show an error message. It has to be a 10x10 array but I don't know how to do it! Help!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    So what are you having trouble with?

    All you need are things like
    array[row][col] = 0;

    or
    if ( array[row][col] == 'X' )
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    How is 10x10 a 3D array?
    If you understand what you're doing, you're not learning anything.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Quote Originally Posted by itsme86 View Post
    How is 10x10 a 3D array?
    My thoughts exactly.

    I'll give you some help with 3D arrays. Don't use them. There are far better data structures available in .NET that will give you the same functionality.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Modifying parallel arrays to arrays of structures
    By xkohtax in forum C Programming
    Replies: 7
    Last Post: 07-28-2011, 12:07 AM
  2. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  3. Passing pointers to arrays of char arrays
    By bobthebullet990 in forum C Programming
    Replies: 5
    Last Post: 03-31-2006, 05:31 AM
  4. Replies: 2
    Last Post: 02-23-2004, 06:34 AM
  5. separating line of arrays into array of arrays
    By robocop in forum C++ Programming
    Replies: 3
    Last Post: 10-20-2001, 12:43 AM