Question
#include // required to use cout, cin, and endl #include // required to setw() using namespace std; // required to use the items defined in
#include
void print(int ** table, int maxrow, int maxcol);
int main() { int ** grid; // pointer to a pointer to integers to create the grid int *element; // pointer to an int to move through the row int col; // loop control variable int row; // control variable int maxr, maxc; // maximum number of rows and columns that the dynamic array will have char ans;
do { system("cls"); cout > maxr >> maxc;
grid = new int*[maxr]; // create a dynamic arrays of POINTERS TO INTEGERS with maxr elements cout
for (int row = 0; row
for (row = 0; row > ans; } while (ans == 'y' || ans == 'Y');
return 0; }
void print(int ** table, int maxrow, int maxcol) // receives the pointer to the grid and the max number of rows and columns to display { int row, col; for (row = 0; row In this exercise, you have to modify the provided implementation of a grid using pointers (see figure 1) so that it is implemented as shown in figure 2. Figure 1 Figure 2 In the implementation of Figure 1 the array of pointers is used to access the rows of the grid while in the implementation of Figure 2 the array of pointers is used to access the columns
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started