我打開了幾年前寫過的一個簡單的MineSweeper程序,如果你可以優化下面的代碼,那麼它就會受到干擾,因爲它看起來並不好看。 以下方法是用於檢查所述索引不超出範圍並返回請求的索引的值: private static bool IsMineOnCoords(bool[,] field, int posI, int posJ)
{
if (posI < 0 || posI > field
我試圖讓我把一些號碼掃描,如果有礦(*),打印繁榮和如果沒有礦,印礦的數量接近它。我找不到代碼的問題,但出現錯誤。如果您發現問題,請進行驗證。 #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10
int main (void)
{
char minefield [N][N];
i
中的分段錯誤錯誤所以我一直在試圖解決這個問題,我必須編寫一個代碼來計算一個假想雷區上某個點附近的地雷數量。下面是代碼: #include <stdio.h>
#include <stdlib.h>
int main(void) {
int row;
int col;
int count;
int mineCount = 0;
int i;