EGY2NET

hello ,

i'm trying to make the minesweeper game as a console application and i wanna randomize 10 mines in a 2 dimension array of 2 variables (i & j) .

0 < i & j < 9 . the game is a board of (81) box (9*9) . that's all

please help me .

thnx .




Re: Visual C++ Language how can i use random functions

Simple Samples

The solution is the same, whether for a console program or a Windows program. Also, the solution is the same for 10 mines as it is for 1 mine. Also, it is the same for each number in a one-dimensional array as for a multi-dimensional array. Therefore all of that is not relevant to your question. So the only thing I understand from what you said is that you need to generate random numbers.

Just look at the documentation; there is a rand() function in the C runtime. Then search in this forum for previous answers about it. If you still have questions, be specific about what you don't understand. If however you need help with the logic of how to write the program then please understand that that is probably outside the scope of this forum.






Re: Visual C++ Language how can i use random functions

Marius Bancila

Before you call rand(), make sure you call srand().

http://www.codeguru.com/forum/showthread.php t=284875






Re: Visual C++ Language how can i use random functions

Simple Samples

Marius Bancila wrote:

Before you call rand(), make sure you call srand().

http://www.codeguru.com/forum/showthread.php t=284875

There are ample previous answers in these forums; no need to go to CodeGuru. If I were to create a link, I would link to the documentation, so that the person can see that the documentation is useful.