8queen
---
---
~cpp #include<iostream> #include<ctime> using namespace std; void main() { // 한 ... // srand(time(0)); // rand() 합. // 하 행할 . -_-;; // int x = rand(); // rand()함 한 하 함. // 하 0 ~ 큰 . // int x1 = rand() % 10; // % 10 하 x1 10 // 0 ~ 9 하 . // int x2 = rand() % 9 + 1; // % 9 하 0~9 // 1 하 1~10 . srand(time(0)); //하 int x = rand() % 6 +2; // do // { // int a = rand() % 7 int arr[8][8]= { {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8}, {1,2,3,4,5,6,7,8} }; // 됬 x 해 흠.... //x 2 됬 해... int i,j; for(i=1; i<9; i++) { i==x?arr[0][i-1]=x :arr[0][i-1]=0; } for(i=1; i<8; i++) { arr[i][x-1]=0; } // 0 for(i=1,j=0; x+j<8; i++,j++) { arr[i][x+j] = 0; } // 0 for(i=1,j=2; x-j==0 ; i++,j++) { arr[i][x-j] = 0; } for(j=1; j<8; j++) { arr[i][x] // 함 do { }while(a!=x-1&&a!=x+1) // 하 ... // 0 함 하... //한 0 표 하 하..... 흠... ... ㅡㅜ;;