Grids, Matrix, 2D Arrays...

This is a discussion on Grids, Matrix, 2D Arrays... within the C++ Programming forums, part of the General Programming Boards category; HURRY!!! I need to know how to create a 10 x 10 grid (or matrix or array, whatever the name ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    2

    Exclamation Grids, Matrix, 2D Arrays...

    HURRY!!!

    I need to know how to create a 10 x 10 grid (or matrix or array, whatever the name is) by 11:00!!

    I know this is about as last-minute as you can get, but I know you guys can help.

    I'm not asking for a program, so don't think I'm lazy. I just can't figure out how to creat a 10x10 grid and then select a random location on that grid.

    I think I've got the location down, but mine may be wrong...

    Thanks

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    int mygrid[10][10]

    Then just pick 2 random numbers (instructions in the FAQ) and access that location

    point = mygrid[x][y];


    where point is where you want to store the value, and x and y are random numbers.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    2

    Another way w/ Randgen.h?

    Thanks for that quick response, but is there another way somehow using randgen.h (from the ap computer science on collegeboard.com) and the functions in there (randomVals.RandInt(low, high))?

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Sounds like it, but I never took APCS... What's wrong with the method in the FAQ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 04:57 PM
  3. What is a matrix's purpose in OpenGL
    By jimboob in forum Game Programming
    Replies: 5
    Last Post: 11-13-2004, 11:19 PM
  4. File I/O with 2D arrays
    By hypertension in forum C Programming
    Replies: 2
    Last Post: 02-04-2003, 07:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21