Random numbers in a array

Pages: 12
@SCB3 You should never use global variables in the first place.
^^ The last part of the project is in fact to change them all into local variables, I'm still learning how to do that atm
On line 30 you already use local variables. They reallY don't hurt:)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void mine_set()
{ 
   
do
	{
		// Note: later (with more understanding) you should introduce constants for this!
		int r=rand()%8;
		int c=rand()%8;
		if (minesweeper[r][c] !=mine)
			{
			minesweeper[r][c]=mine;
			mines++; // Note: ++
			}
		
	}
		while (mines<10);
	
}
THANK YOU!

Now I can focus on the rest, I need to output a number when the player reveals it and its not a mine, it shows how many squares away they are
Topic archived. No new replies allowed.
Pages: 12