and what has this to do with Windows programming. It seems like a console program?
You can treat the board as either a 2-d array of n x n elements or as a single 1-d array of n * n elements and then access it as if it was a 2-d array.
There is also at least two ways of generating the board and displaying. One is to generate the board with the mines and then as displaying calculate the number of adjacent mines. The other is to update the adjacent mine info when the position of a mine is first determined.
When generating the random location of the mine, you can either generate 2 numbers if a 2-d array is used or one number if a 1-d array is used or the number is converted to a 2-d array if that is used.
To place the mines, you need a nested loop. The outer loop to loop k times. The inner to loop until a non-occupied position is found.
Do you know how to generate random numbers in C++ using std::uniform_int_distribution() - and how to seed the generator using std::random_device or other?
This will produce a set of (non-unique) random numbers: