HELP! c++ need advice

I am a student who has been asked to create a text based minesweeper game with these specifications using C++ using visual studio 2010

"Turn 1 - Mines Left 10 - Correct Guesses 0 - Guesses Left 20

?????
?????
?????
?????
?????

Please enter the row to check (1-5):

Each turn the player should enter a row and column to check, e.g.:

Please enter the row to check (1-5): 2
Please enter the column to check (1-5): 1

The program should ensure the values selected are within the correct bounds, and should also prevent the player from trying to select a previously tried element. If the guess is correct the program congratulates the player and reveals the correctly guessed element in the grid, if not the player should be told they "missed".

The game should display a grid that shows how the guessing has progressed, along with the turn number, the number of mines left, the number of correct guesses so far and the remaining guesses. If an element hasn't been guessed it should show a '?', otherwise the previously guessed positions should be shown, with an 'O' for a miss and an 'M' for a hit. Here is how the game might look after a number of turns and several correct guesses:

Turn 10 - Mines Left 5 - Correct Guesses 5 - Guesses Left 11

OM???
?M?MO
???OO
??M?M
?????

Please enter the row to check (1-5):

The game should continue until either the guesses run out, in which case the game should stop and the player should be commiserated, or the player correctly guesses all of the mine positions so they should be congratulated and told how many guesses it was done in and how many were left. The final state of the grid should also be shown, as well as the grid with all un-guessed elements revealed."




This is the code that i have done so far and its due in tomorrow i only have a basic understanding of coding

This is what i have done is there anything i could improve?
i havnt included guesses into my minesweeper game does anyone know how to do that?

#include "StdAfx.h"
#include<iostream>
#include<conio.h>
#include<string>
#include<cstdlib>
#include<ctime>

using namespace std;

int main ()


{
srand(time(NULL));

int row, column;

int Go= 1, mine_ctr=0;

int play_row, play_column;

char actualarray[5][5] =

{{ '?','?','?','?','?',},//This is the Array that will show to the user
{'?','?','?','?','?',},
{'?','?','?','?','?',},
{'?','?','?','?','?',},
{'?','?','?','?','?',}};


char boardarray[5][5] =

{{ '0','0','0','0','0',}, //This is the array that is going to place the mines.
{ '0','0','0','0','0',},
{ '0','0','0','0','0',},
{ '0','0','0','0','0',},
{ '0','0','0','0','0',}};

int array[5][5]; //This is going to store the choices made by the user

for (int x=0; x<10; x++)

{

row = rand ()%5; //This will place mines at random

column = rand()%5;



if (boardarray[column] [row] !='m')

{
boardarray[row][column] = 'm'; // "m" is the letter shown when you hit a mine


}

else x--;


}

cout<< "Minesweeper" <<endl;

for(int row=0; row<5; row++)

{
for(int column=0; column<5; column++)
{
cout<<actualarray[column][row]<<" "; // Displays array
}
cout<<endl;
}
while (Go < 21)
{
cout<<endl;
cout<< "Go"<<endl;
cout<< "Mines found:"<<mine_ctr<<" "<<"Mines Hidden:"<<10 - mine_ctr<<endl;
//Displays if any mines are found an how many are hidden

cout<< "Step One Pick a Row 1-5: ";

cin>>play_row;
cout<<"Step Two, Select a column 1-5: ";
cin>>play_column;

cout<<endl;



if((play_row < 1) || (play_row > 5))



{
cout<< "Remember, choose between 1 - 5"<<endl; //This will stop the user entering numbers larger than the grid
system("pause");
continue;


}

if (boardarray[play_row-1][play_column-1] =='m')

{
cout<< "Mine Found! "<<endl;
actualarray[play_row-1][play_column-1] = 'm'; //Shows location of mine
mine_ctr++;
for (int row=0; row<5; row++)
{
for(int column=0; column<5; column++)
{
cout<<actualarray[row][column]<<" ";
}
cout<<endl;

}
}

else
//This will show an F to show the flagged area the user has been before
{
cout<<" You failed to locate a mine "<<endl;
actualarray[play_row-1][play_column-1] = 'F';

for(int row=0; row <5; row++)

{
for(int column=0; column<5; column++)
{
cout<<actualarray[row][column]<<" ";
}
cout<<endl;


}
}// Tells the user if they have already selected that combination of numbers

if(array[play_row-1][play_column-1] == 1)

{

cout<<" That position has already been selected please choose another row and column "<<endl;
system("pause");
continue;
}
array[play_row-1][play_column-1]=1;

if(mine_ctr == 10)

{
cout<<" WINNER! "<<endl;
break;
}

Go++;


}
if(Go==21)

{
cout<<" Try again? "<<endl;
}

_getch();


}


Topic archived. No new replies allowed.