I am making a console game and I am making a map. The map is an array of vectors. The vectors contain the characters that I am printing to the console. My code:

"Window.h"

```
#include <string>
#include <vector>

class Row {
public:
    std::vector<char> row;
    int id;
    Row();
    void printRow();
    void resetRow();
    void insertStringIntoRow(std::string toInsert, int startIndex);
    std::vector<char> getRow() {
        return row;
    }
};

class Window {
public:
    void showMap();
    void writeToMap(std::string stringToInsert, int rowNum, int startIndex);
    void writeInRectangle(std::string stringToWrite, int rowNum, int startIndex);
    void setCursorToPosition(int x, int y);
    void resetMap();
    Row getRowAt(int index);
};

void initColors();
void setWindow(Window windowToSet);
Window getGameWindow();

```

"Window.cpp"

```
#include "Window.h"
#include <iostream>
#include <Windows.h>
#include <WinBase.h>
#include <stdlib.h>
#include "color.h"

using namespace eku;

Row map[25];

//Class Window
void Window::showMap() {
    setCursorToPosition(0, 0);
    for (int i = 0; i < 25; i++) {
        getRowAt(i).printRow();
    }
}

void Window::writeToMap(std::string stringToInsert, int rowNum, int startIndex) {
    Row r = getRowAt(rowNum);
    r.insertStringIntoRow(stringToInsert, startIndex);
}

void Window::writeInRectangle(std::string stringToWrite, int rowNum, int startIndex) {
    if (startIndex != 0) {
        std::string topbar = "~";
        for (int i = 0; i < stringToWrite.length() + 2; i++) {
            topbar += ' ';
        }
        topbar += '^';
        getRowAt(rowNum - 1).insertStringIntoRow(topbar, startIndex - 1);
    }

    std::string toInsert = "~ ^" + stringToWrite + "~ ^";
    getRowAt(rowNum).insertStringIntoRow(toInsert, startIndex - 1);

    if (startIndex != 25) {
        std::string bottombar = "~";
        for (int i = 0; i < stringToWrite.length() + 2; i++) {
            bottombar += ' ';
        }
        bottombar += '^';
        getRowAt(rowNum + 1).insertStringIntoRow(bottombar, startIndex - 1);
    }
}

void Window::setCursorToPosition(int x, int y) {
    HANDLE hOut;
    COORD Position;
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    Position.X = x;
    Position.Y = y;

    SetConsoleCursorPosition(hOut, Position);
}

void Window::resetMap() {
    for (Row row : map) {
        row.resetRow();
    }
}

Row Window::getRowAt(int index)
{
    return map[index];
}

//Class Row
const char WHITEBACKCOL = '~';
const char DEFCOL = '^';

int i = 0;

Row::Row() {
    row.resize(80, ' ');
    id = i;
    i++;
}

void Row::printRow() {
    for (int i = 0; i < row.size(); i++) {
        switch (row[i]) {
        case WHITEBACKCOL:
            setcolor(black, white);
        case DEFCOL:
            setcolor(white, black);
        default:
            std::cout << row[i];
        }
    }
}

void Row::resetRow() {
    row.resize(80);
    for (int i = 0; i < 80; i++) {
        row[i] = ' ';
    }
}

void Row::insertStringIntoRow(std::string toInsert, int startIndex) {
    int endIndex = (startIndex + toInsert.length());
    int stringPos = 0;
    for (int i = startIndex; i < endIndex; i++) {
        if (i < row.size() - 1) {
            row.at(i) = toInsert[stringPos];
        }
        else {
            row.push_back(toInsert[stringPos]);
        }
        stringPos++;
    }
}
Window defWindow;

void initColors() {
    concolinit();
    setcolor(white, black);
}

void setWindow(Window windowToSet) {
    defWindow = windowToSet;
}

Window getGameWindow() {
    return defWindow;
}

```

"Main.cpp"

```
#include <iostream>
#include "GameEngine.h"
#include "Window.h"

int main() {
    setWindow(Window());
    initColors();

    getGameWindow().writeInRectangle("Hia", 1, 10);

    getGameWindow().showMap();
}

```

Whenever I call `showMap()` all I get is a blank console. It seems to be only printing the default map of spaces instead of the text I entered. I also tried using just `printRow()` to print the single rows that I edited but they also showed only spaces.
I was able view changes to the vector row in the `insertStringIntoRow()` method but then even though the changes should there they didn't show anywhere else. It almost seems like my `Row` object is being created every time I access it. I am new to C++ so any help is appreciated. Thanks in advance!