From ef30b22d71f83d79819da2c074adf2c3aab668a0 Mon Sep 17 00:00:00 2001 From: pngtmzsyq <864002285@qq.com> Date: Sat, 4 Nov 2023 18:51:25 +0800 Subject: [PATCH] Delete 'suiji.c' --- suiji.c | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 suiji.c diff --git a/suiji.c b/suiji.c deleted file mode 100644 index e2ece7d..0000000 --- a/suiji.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -void swap(int *a,int *b){ - int temp; - temp=*a; - *a=*b; - *b=temp; -} -void shuffle(int *array,int size){ - int i; - int j; - for(i=size-1;i>=0;i--){ - j=rand()%(i+1); - swap(&array[i],&array[j]); - } -} -void print(int board[9][9]){ - printf("|---|---|---|---|---|---|\n"); - int i=0,j=0,s=0,k=0; - for(i=0;i<9;++i){ - for(j=0;j<9;j++){ - while(j%3==0){ - printf("| "); - break; - } - printf("%d ",board[i][j]); - } - printf("|\n"); - while((i+1)%3==0){ - printf("|---|---|---|---|---|---|\n"); - break; - } - } -} -int main(){ - int board[9][9]={0}; - int number[9]={1,2,3,4,5,6,7,8,9}; - srand(time(NULL)); - int i=0,j=0,k=0,s=0; - for(k=0;k<3;k++){ - shuffle(number,9); - int column[3]={0,3,6}; - for(i=0;i<3;i++){ - for(j=0;j<3;j++){ - board[k*3+i][column[j]]=number[i*3+j]; - } - } - } - print(board); - return 0; -}