Hi Guys! I am a noob in C++ programming. I have lots of ideas and stuff in my mind limited however only to the stock knowledge I have.
I have to make a simple and easy minesweeper game for my finals in C++.
I barely have any idea on how to start it with, but what I am thinking and know is it has to have something to do with two or multi dimensional arrays, setting a random number generator for the mine-spawn, and maybe something with key manipulation as controls.
cout<<"Please input desired box size for height and width, respectively.\n";
cout<<"x = ";
cin>>x;
cout<<"y = ";
cin>>y;
int total, spawn=total/4;
int rows, cols;
char Table[x][y];
for (rows=0;rows<x;rows++)
{
for (cols=0;cols<y;cols++)
{
//assigns the value 15 to each of the array's variable
Table[rows][cols] = 'O';
}
}
for (rows=0;rows<x;rows++)
{
for (cols=0;cols<y;cols++)
{
//prints every item of the array
cout<<Table[rows][cols]<<" ";
}
cout<<endl;
}
for (mines=0;mines<spawn;mines++)
{
int rundom=rand()% spawn;
cout<<endl;
system("pause");
return 0;
}
Please help me. I have about 3 days left. At the last unfinished part, I am struggling on how to put the random generated number on the corresponding index/array which is where the mine is to be placed. Correct me please for everything. THANKS!!!!