arrays\

This is a discussion on arrays\ within the Game Programming forums, part of the General Programming Boards category; could some one give me a quick example on how to use arrays to print out a simple 2d grid ...

  1. #1
    Unregistered
    Guest

    Question arrays\

    could some one give me a quick example on how to use arrays to print out a simple 2d grid
    \
    thanx

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

    Well...

    I did a tic tac toe program that had the array char board[3][3].
    to print it out, i went like this:

    cout<<board[1][1]<<" "<<board[1][2]<<" "<<board[1][3]<<endl;
    cout<<board[2][1]<<" "<<board[2][2]<<" "<<board[2][3]<<endl;
    cout<<board[3][1]<<" "<<board[3][2]<<" "<<board[3][3]<<endl;

    the first number is the row, the second is the column.

  3. #3
    Unregistered
    Guest

    move ment

    ok thanx.

    but how do i move a object on it such as the letter 'X' around the board using the arrow keys or could you tell me were i could find a good tutorial on that sorta stuff

    thanx

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    cout<<board[1][1]<<" "<<board[1][2]<<" "<<board[1][3]<<endl; (<- this part is continued)

    could some one tell me were the parse error is befor the '<'

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

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