i need to write a program as follows:

Write a program that prompts the user to enter three positive integers representing the number of rows, the number of columns of a grid, and the number of mines hidden in the grid, the program then calls the following function:

void Minesweeper(int nRows, int nColumns, int nMines )

The function Minesweeper( ) prints a grid of nRows x nColumns of 0's and 1's. A 0 represents a square that has no mine and a 1 represents a square that has a mine. The parameter nMines represents the number of mines.

Hint: Store the 0's and 1's in a two dimensional array first then print that array.

i have started it, but i have no idea on where to to go about with this. i will paste my code down below, but i know it wont help much.

i just need someone to point me to the right direction on how to solve it. i know i need to store the values into an array, but i'm a little confused on how to do that with variables? and i assume that my task is to generate the user-defined number of mines into random parts of the array- i dont even know where i would go about trying to figuring that one out.

here's my code:

```
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void minesweeper(int numbers_r, int numbers_c, int numbers_m);
int main (){
int numbers_r, numbers_c, numbers_m;
//int mineArray[numbers_r][numbers_c];
cout<<"Enter the number of rows: ";
cin>>numbers_r;
cout<<"Enter the number of columns: ";
cin>>numbers_c;
cout<<"Enter the number of mines: ";
cin>>numbers_m;
minesweeper(numbers_r, numbers_c, numbers_m);
return 0;
}
void minesweeper(int nRows, int nColumns, int nMines){
for(int i=0; i<nRows; ++i)
mineArray_ptr[i]=new int[nColumns];
char mines_chr= '1';
char not_mines_chr= '0';
//if (nMines>0)
// int n_not_mines=(nRows*nColumns)-nMines;
//else
// mineArray[i][j]=0;
// int mineArray[sRows][sColumns];
for (i=0; i<nRows; i++) {
for(int j=0; j<nColumns; j++)
if (nMines>0)
int n_not_mines=(nRows*nColumns)-nMines;
else
mineArray[i][j]=0;
//mineArray_ptr[i][j]=0;
// cout<<" test "<<mineArray_ptr[i][j];
cout<<setw(5)<<mineArray_ptr[i][j];
}
}
```

its not a real code really, its just a bunch of my thoughts all put together because i really cant get anywhere.

i feel this program is simple and i am over thinking it.

what i do know is that i need to initialize the whole array to zero, and then somehow randomly place the mines, but i don't really know how to.

some examples and explanations of what i have right/wrong and how to solve will be greatly appreciated.

thanks in advance!