Thread: values into array based on coordinates

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    1

    values into array based on coordinates

    Hi,

    Here is the problem I'm trying to develope some code for, but I need ideas.

    I have a data file that contains pairs of numbers that represent coordinates in a 20x20 array. I need to read in these coordinates, and in those coordinates put in the value '1', and all other coordinates must be left empty (or maybe 0 could go there).

    I'm sorry I don't have any code or even a good idea of what I can do. I'm really stumped and just need some clues about what direction to go in (I know I need to use a loop of some sort).

    Thanks!

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Start with the code that creates the 20x20 array, fills it with 0's and outputs it to the screen.

    Once you get that code written, compiling successfully, and running, then start on the rest.

    The rest will include reading from a file, so a good start would be to open the file. Then you would want to loop through the contents of the file. When you get to that part, if you are having trouble, feel free to ask a question about that specific issue (or any other).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Storing values from Edit Box into an array
    By E_I_S in forum C++ Programming
    Replies: 10
    Last Post: 06-05-2008, 06:24 AM
  2. putting values into an array
    By zdream8 in forum C Programming
    Replies: 15
    Last Post: 05-21-2008, 11:18 PM
  3. Array help!
    By killcapital in forum C Programming
    Replies: 4
    Last Post: 04-15-2008, 01:23 AM
  4. ordering vector elements based on heuristic values
    By cyberfish in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2007, 12:33 AM
  5. How to read in empty values into array from input file
    By wpr101 in forum C++ Programming
    Replies: 5
    Last Post: 11-28-2002, 10:59 PM