I have this project for school that requires a 2D array of [24] [60] filled with spaces that will be set to characters to draw shapes(square, circle, triangle, and a point). The purpose of the program is to learn inheritance. I have the grid working fine, I just need to figure out this set function to receive the parameters (int ROW, int COL, char c) and set the initial point which will be the upper left corner of the shape. The other classes will draw the rest of the shape, but I'm not even there yet. grid.cpp
#include "grid.h"
Grid::Grid()
{
for (int i=0; i<x; i++)
{
for (int j=0; j<y; j++)
{
cGrid[i][j]=' ';
}
}
}
void Grid::set(int x, int y, char c)
{
// Takes entered (x,y)
// If the coordinate is in the grid, set position equal to char c.
// If the coordinate is outside the grid, do nothing
}
void Grid::print()
{
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
cout << cGrid[i][j];
}
cout << endl;
}
}