diff --git a/t2.cpp b/t2.cpp deleted file mode 100644 index e8b279c..0000000 --- a/t2.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -int board[9][9] = {0}, f[9] = {0}; -void f1() -{ - printf("|"); - for (int i = 0; i < 23; i++) - { - printf("-"); - } - printf("|\n"); -} -void operate() -{ - for (int i = 0; i < 9; i++) - { - if (i % 3 == 0) - { - f1(); - } - printf("| "); - for (int j = 0; j < 9; j++) - { - if (j % 3 == 0 && j) - { - printf("| "); - } - printf("%d ", board[i][j]); - } - printf("|\n"); - } - f1(); -} -void random(int n) -{ - int k = 9; - while (k) - { - int i = rand() % 3, j =rand() % 9; - i += (n - 1) * 3; - if (f[i] == 0) - { - if (board[i][j] == 0) - { - board[i][j] = k; - k--; - } - } - int cnt = 0; - for (int m = 0; m < 9; m++) - { - if (board[i][m]) - { - cnt++; - } - } - if (cnt == 3) - { - f[i] = 1; - } - } -} -int main() -{ - printf("Ëæ»ú¾ØÕóΪ£º\n"); - srand(time(NULL)); - random(1); - random(2); - random(3); - operate(); -} \ No newline at end of file