Thread: Arrays...

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    Arrays...

    Ok, in the tutorial about arrays, it said to picture it like this:
    (then it had boxes)

    I'm a little confused on the two-dimensional arrays. It said you could use them to make things like tic tac toe games. Well, how would you go about doing that?

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    in the simplest explaination:

    multidemsional arrays are just arrays of arrays
    so if i did this

    char array[2][3];

    it would be 2 arrays of 3 char's each.


    get it?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    ok

    alright, but is it possible to make a tic tac toe game with the information is tutorials 1 through 9?

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    actually, i can't say i havn't read them, but i don't doubt it.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    Registered User EvenFlow's Avatar
    Join Date
    Oct 2001
    Posts
    422
    You should be able to. It won't be anything fancy, but you could use a array of chars to hold the positions of the pieces etc.
    Ramble on...

  6. #6
    Unregistered
    Guest

    Wink

    Ok i have this question for you guys!!!
    a b
    *************
    * 1 * 2 *
    * 2 * 4 * <<<< Array 1
    * 3 * 8 *
    * 4 * 0 *
    * 5 * 2 *


    *************
    * 1 * a *
    * 2 * b * <<< Array 2
    * 3 * c *
    * 4 * d *
    * 5 * e *
    *************

    I want to make a cpp program that will combine those array and make another array with 4 columns but my problem is how could i combine both char and integer into one array.

  7. #7
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Use a struct/class -

    struct data
    {
    char a;
    int b;
    };

    Then create an array of data's.
    zen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function to read in two arrays
    By ssmokincamaro in forum C Programming
    Replies: 7
    Last Post: 11-12-2008, 07:59 AM
  2. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 04:24 PM
  3. Replies: 16
    Last Post: 01-01-2008, 04:07 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