// MINESWEEPER
void main()
{
int b;
do
{
cout << "Enter number of squares per side (2 - 10)" << endl;
cin >> b;
}while(b < 1 && b >= 10);
int board[b][b]; //0 - 8 = # of mines, 9 is mine
int revealed[b][b]; //1 is revealed
int i = 0;
int j = 0;
int x = 0;
int y = 0;
int z; //number of mines
int q;
int t = 0; //game over input
int dead = 0;
do
{
cout << "How many mines? (1 - " << ((b*b)-1) << ")" << endl;
cin >> z;
}while(z <= 0 && z >= ((b*b)-1));
for(i=0;i<b;i++)
for(j=0;j<b;j++)
board[i][j] = 0;
i = random(i, b);
j = random(j, b);
cout << "Generating board..." << endl;
do
{
i+=3;
j+=6;
x = random(i, b);
y = random(j, b);
if(board[y][x] != 9)
{
board[y][x] = 9;
...
Read more »