Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that includes the functions listed as follows: clearfield(): Takes a 20x20 2-dimensional integer array that represents a minefield. The function must

image text in transcribed
Write a C program that includes the functions listed as follows: clearfield(): Takes a 20x20 2-dimensional integer array that represents a minefield. The function must assign all elements to 0. putMine (.): Takes a 20x20 2-dimensional integer array (minefield), and two integers row and column. The function must assign the element at [row,column) in the array to -1. processField (.): Takes 20x20 2-dimensional integer array (minefield). In the minefield, -1 represents a mine is placed at that location. The function must fill the elements other than the mines with the number of mines that the element is neighbor to (including diagonal neighbors). printField(): Takes 20x20 2-dimensional integer array (minefield). The function must print the field by printing instead of '-1' for the mines. main (): Creates a minefield, clears it by using clear Field() and puts arbitrary number of mines to the minefield by using putMine () function. After that, the minefield must be processed and printed by using process Field() and printField() functions. Example: For a field of 4x4 first the following array is created. 0000 0000 0000 0000 Then some mines are put as follows 00-10 0000 0-100 000-1 Then, after processing the field, it is as follows 01-11 1221 1.121 112-1 Also, it is printed as follows 01'1 1221 1.21 112

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions