vectors acting up?

This is a discussion on vectors acting up? within the C++ Programming forums, part of the General Programming Boards category; I can't work this one out.. please help. I have a matrix (vector<vector>), and fill it with chars read from ...

  1. #1
    hsv
    hsv is offline
    Registered User
    Join Date
    May 2003
    Posts
    14

    vectors acting up?

    I can't work this one out.. please help.

    I have a matrix (vector<vector>), and fill it with chars read from file.
    Code:
    //-- while still stuff to read
    for(int i=0; i<=width && y<=height; i++)
    {
    	v.put(y, i, templine[i]);
    	cout << v.at(y, i);
    }
    y++;
    cout << endl;
    Here it looks as it should, something like:

    ******
    ******
    ******

    Then I call this:
    Code:
    for(int i=0; i<height; i++)
    {
                    for(int j=0; j<width; j++)
    	             cout << v.at(i, j);
    	cout << endl;
    }
    And it looks like this:
    *****
    ******
    ******

    What am I missing here?!
    /hsv

  2. #2
    hsv
    hsv is offline
    Registered User
    Join Date
    May 2003
    Posts
    14
    oh.. I guess I'm a bit too tired for this right now. But it actually helped posting the code here, as I could see the error right away.

    sorry, I'm going to take a break now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vectors
    By naseerhaider in forum C++ Programming
    Replies: 11
    Last Post: 05-09-2008, 09:21 AM
  2. How can i made vectors measuring program in DevC++
    By flame82 in forum C Programming
    Replies: 1
    Last Post: 05-07-2008, 03:05 PM
  3. How properly get data out of vectors of templates?
    By 6tr6tr in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2008, 11:35 AM
  4. How to use Vector's in C++ !?!
    By IndioDoido in forum C++ Programming
    Replies: 3
    Last Post: 10-14-2007, 12:13 PM
  5. Points, vectors, matrices
    By subnet_rx in forum Game Programming
    Replies: 17
    Last Post: 01-11-2002, 02:29 PM

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