/* Rafay Ahmad 23I-2526 */ #include using namespace std; class Minesweeper{ char** grid; int* mineLocations; int size; int mines; int opened; public: Minesweeper(int size, int mines) : size(size), mines(mines), opened(0){ srand(time(0)); grid = new char*[size]; for(int i=0;i0 && col0) revealCell(row-1, col, false); if(row>0 && col>0) revealCell(row-1, col-1, false); if(row0 && col0 && mineLocations[i]/size == row-1 && mineLocations[i]%7 == col) count++; if(row>0 && col>0 && mineLocations[i]/size == row-1 && mineLocations[i]%7 == col-1) count++; if(col>0 && mineLocations[i]/size == row && mineLocations[i]%7 == col-1) count++; if(row0 && mineLocations[i]/size == row+1 && mineLocations[i]%7 == col-1) count++; if(row>size; cout<<"Enter no Of mines: "; cin>>mines; Minesweeper game(size, mines); while(!game.checkWin()){ game.displayGrid(); cout<<"Enter row: "; cin>>row; cout<<"Enter col: "; cin>>col; cout<<"Enter F to flag or R to reveal: "; cin>>c; if(row