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 ..... ... ... ㅡㅜ;;