// One-star problem // Problem 10189 Minesweeper /* This program is written by Prof. Chua-Huang Huang Department of Information Engineering and Computer Science Feng Chia University Taichung, Taiwan Disclaimer: The programming problem is downloaded from UVa Online Judge (https://uva.onlinejudge.org/). The program solution is provided for helping students to prepare Collegiate Programming Examination (CPE). The author does not guarantee the program is completely correct to pass UVa Online Judge platform or CPE examination platform. This program is not intended for a student to copy only. He/She should practice the programming problem himself/herself. Only use the program solution as a reference. The author is not responsible if the program causes any damage of your computer or personal properties. No commercial use of this program is allowed without the author's written permission. */ #include #include int main(void) { int M, N; // Size of the field. int index = 1; // Field index, initial value is 1. int i, j; // Loop variables. char field[100][100]; while (scanf("%d %d", &M, &N)) { // Input M and N. if (M==0 && N==0) break; // Terminate the program when both M and N are 0. for (i=0; i=0 && j-1>=0 && field[i-1][j-1]=='*') field[i][j]++; // upper-left cell. if (i-1>=0 && field[i-1][j]=='*') field[i][j]++; // upper cell. if (i-1>=0 && j+1=0 && field[i][j-1]=='*') field[i][j]++; // left cell. if ( j+1=0 && field[i+1][j-1]=='*') field[i][j]++; // lower-left cell. if (i+1