Resizing a 2D vector of structs

Posted In: Resizing a 2D vector of structs
  • Profile photo of JavaBitch
    JavaBitch on: June 29, 2016 at 7:30 pm #320

    Hello, I’m working on making a minesweeper game using C++ but I’m having trouble re sizing a vector.

    Here’s what I have:
    A vector of ints:


    A vector of structs:


    The vector of cell is located in a separate .cpp file of a minesweeper class.
    What I want to do is re size the vector of cell to have the same dimensions as the vector of ints.
    and initialize the struct variable *value* to the values in the vector of ints and the struct
    variable *state* to 0.

    This is what I have tried so far:


    When attempt to run this I am only able to have the dimensions 5 rows x 5 columns (I cannot figure out why). Any
    other dimensions exits the program and netbeans tells me the run has failed.

    I have also tried:


    When trying to resize this way, nothing works.

    And this way:


    Attempting this lets the program run but doesn’t work for any dimensions combination.

    Any help is greatly appreciated, thank you.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Skip to toolbar