Hi,
I have homework assignment to make a minesweeper game using classes. In that game I have 3 lives,when I enter coordinates with I loose life,otherwise i get point. Here is how I tried to solve the problem,but I have some errors in it. Can you check it please and add something what I am missing.
#include<ctime>
#include<iostream>
#include<cstdlib>
using namespace std;
class grid
{
int table[8][8];
for(int f=0;f<=7;f++)
for(int g=0;g<=7;g++)
table[f][g]=(rand()%2);
};
int grid::selectCoords (int& x,int& y)
{
cout<<"enter first coordinate:";
cin>>x;
cout<<"enter second coordinate:";
cin>>y;
}
int grid::check(int& x,int& y,int& n,int table[8][8],int& p)
{
if(table[x][y]==1)
{
n++;
cout<<"You lost one life!"<<3-n<<endl;
}
else if(table[x][y]==0)
p++;
cout<<"number of points:"<<p<<endl;
if (x,y<=8)
{
cout<<endl;
}
else
cout<<"invalid number"<<endl;
}
int main()
{
grid select;
select.selectCoords(int& x,int& y);
select.check(int x,int y);
do{
select.selectCoords(int x,int y);
select.check(int x,int y);
}
while(int n<3);
cout<<"game over"<<endl;
system("PAUSE");
return 0;
}