U E D R , A S I H C RSS

8queen/손동일

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}
	};

//배 &#46124;고  x를  .... 
//x가 2가 력 &#46124;다고 ...


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


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:20
Processing time 0.0126 sec