I have previously created a board for a domineering game but now I am trying to make the board one dimensional for a game called toads and frogs and I don't know where to start, if it is possible that I don't have to include an array to make the one dimensional then that would be good.
#include<Windows.h>
#include<iostream>
#include<vector>
using namespace std;
int main()
{
// specify default value to fill the vector elements
int mapSize = 8;
int x = 0;
int y = 0;
int horizontal = 0;
int vertical = 0;
cout << "Enter the size of board => ";
cin >> mapSize;
vector< vector<char> > board(mapSize, vector<char>(mapSize, 'e'));
for (int i = 0; i < mapSize; i++) {
for (int j = 0; j < mapSize; j++) {
cout << board[i][j] << " ";
}
cout << endl;
}
}
Please login or Register to submit your answer