Minesweeper game - HOMEWORK!

I need help with minesweeper game - thanks!
Last edited on
Do you have any code?
How about you give it a go on your own, and come back here to let us know exactly what parts you are having problems with. That way we aren't doing the homework for you and we know exactly what it is that you are having problems grasping or coding.

=)
can find the reason why it crashes

Last edited on
What Would Mr. Alex say if he would know what is happening here?
:)))
Maybe if you share a part of the code i'll be silent:P
haha,jk:)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <cstdlib> 

using namespace std;
void initial_fields(int field[][4]){
     for (int i=0; i<4; i++)
     {
         for (int o=0; o<4; o++)
             field[i][o]=(rand()%2);
             
     } 
}
void input_coord(int& x, int& y){
    cout<<"insert your x coordinate(from 0 - 3): ";
    cin>>x;
    cout<<"insert your y coordinate (from 0 - 3): ";
    cin>>y;
}

void checkin(int& x, int& y, int& counter, int field[][4]){
    if(field[x][y]==1)
    {
        counter++;
        cout<<"You have lost your life, you have: "<<3-counter<<"more";
        cout<<"\n\n"; 
    }
    else
        cout<<"You are doing well!"<<char(1)<<endl;
}

int main(){
int counter=0;
int x, y;
int field[4][4];
initial_fields(field);
do{
input_coord(x,y);
checkin(x,y,counter,field);
}while(counter<3);
cout<<"You lost all of your lives = GAME OVER!";
system("pause>0");
return 0;
}


Other than a few syntax error and lack of references theres nothing really wrong (other than the fact that you can't win).
The above example works fine.
HB88: He never said that we are forbidden to ask for little help XD
Im sure ur task is already finished and you wount steal my code XD

thanks warnis
Last edited on
Topic archived. No new replies allowed.