In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of how to write mine clearance code in C language, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this C language to realize how to write mine clearance code. let's take a look.
Minesweeping OvO0 is realized by C language. Print menu void menu () {printf ("* *\ n"); printf ("* 1. Play *\ n"); printf ("* 0. Exit *\ n "); printf (" * *\ n ");} 1. Initialize the chessboard
Before initializing the chessboard, we set the chessboard size to 9 × 9
But that doesn't mean we have to create a 9 × 9 two-dimensional array.
Since we are going to use coordinates for demining, we have to print line numbers and column numbers.
We are going to set up two arrays, one to store the number of mines around each location, and one to print a real-time chessboard.
Void initial (char board [ROWS] [COLS], int rows, int cols, char c) {for (int I = 0; I < rows; iTunes +) {for (int j = 0; j < cols; jacks +) {board [I] [j] = c;}
We use the initialization function above to initialize the array.
/ / initialize the information disk to'0' initial (mine, ROWS, COLS,'0'); / / initialize the mineplate to'* 'and mine mine against' * 'when demining / / isn't it a mystery to initial (show, ROWS, COLS,' *'); 2. Print chessboard
We print the chessboard with two for loops.
Void display (char board [ROWS] [COLS], int row, int col) {for (int I = 0; I = 1 & & x = 1 & & y
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.