im a biginner level in Visual C++ version 6.0
"how can i Write the Program ”Minesweeper”. On field by size NxM Computer by casual image places X mines. The user will alternately assign the number of cell but computer gives him amount of mines, residing in nearby cells. If and player has fallen into cell, where inheres the mine, that it has lost and play begins first. It is considered that player win if it has opened all empty cells."

>>im a biginner level in Visual C++ version 6.0
That's unfortunate because that old compiler doesn't support c++ very well. You will be much better off if you download VC++ 2008 Express, which is free for the downloading.

Otherwise, I don't know the answer to your question.

im a biginner level in Visual C++ version 6.0
"how can i Write the Program ”Minesweeper”.

You don't. That is not a program for a beginner. Start with something easy like craps or tic-tac-toe.

Hmmm. That seems like a pretty advanced thing for a beginner to be doing. Is it text based? Implementing graphics? And what do you expect from this forum? Nobody is going to right the program for you :-/

To give you an idea of the reason you got the responses you've gotten here's a brief synopsis of the basic tools/concepts I'd use to try to do this.

I'd start with a two dimensional array declared on the heap using dynamic memory and initalized to a default value. Then I'd sprinkle a random number of mines in random locations. Each time the user selects a cell I'd look at the value of the selected cell. If it equals bomb, then game over. If it indicates previously selected, that is not a bomb and not default, then further choice is possible. Otherwise it was a safe choice. If you keep track of the total cells, the total bombs, and the total number of correct guesses you will know when all correct guesses were made and that is correct to indicate a win.

It's been a while since I've played minesweeper, but if I remember correctly each cell also holds a value including the number of bombs it is adjacent to, ranging from 0 - 8, including neighboring cells on its faces and corners. To readily include this information I would most likely use the concept of structs/classes and the topics associated therewith. When a player selects a non bomb cell, then all surrounding cells that aren't touching a bomb will be indicated as selected and the rim of cells actually touching a bomb will display how many bombs each is touching. How to search for a rim of cells touching bombs would involve some sort of a search protocol, breadth or depth first, probably including a stack or a queue of some sort, and maybe a recursive function.

Finally, you might want to go with a graphical user interface to actually change the appearance of each cell on active/passive selection rather than just printing a table of characters to the screen.

That's a lot of concepts to have at your disposal, even for the initial level of the game. If you're reasonably familiar with most of the concepts at a given level, then go for it, learning as you go if needed. If not, keep a list of concepts as you go along and when you've accumulated enough, then give it a shot. And remember, every person who's ever written a game had to start at the same place you're at, so it can be done, if you have enough patience, perseverance, and self determination. It never hurts to have a source of support, like this board, either, of course; but, you'll get a better sense of accomplishment and be more likely to attract meaningful assistance when needed if you do what you can, demonstrate your knowledge and efforts by asking solid questions and posting relevant information.

Good luck on journey!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.