~cpp #include<iostream> #include <ctime> using namespace std; /* { 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~8 들 // 1 더면 1~9 됩. return 0; } */ void main() { srand(time(0)); int arr[5][5] = {{0,},}; int x = rand() % 5; int y = rand() % 5; arr[x][y] = 1; while( ) { } switch(num) { case 1 : x=x-1; y=y+1; break; case 2 : x=x; y=y+1; break; case 3 : x=x+1; y=y+1; break; case 4 : x=x-1; y=y; break; case 5 : x=x+1; y=y; break; case 6 : x=x-1; y=y-1; break; case 7 : x=x; y=y-1; break; case 8 : x=x+1; y=y-1; break; } arr[x][y] += 1; /* do { for(int i=0; i<5; i++) { for(int j=0; j<5; j++) { } } } */ int i,j; for(i=0; i<5; i++) { for(j=0; j<5; j++) { if (arr[i][j] == 0) //를 부르면 ... } } for(i=0; i<5; i++) { for(j=0; j<5; j++) { } } while (arr[i][j] !=0) //루를 돌 ... arr[i][j] != 0 //면 ... cout << arr[i][j] }while( /* if(x>0 && x<4 && y>0 && y<4) { int i = rand() % 3 -1; int j = rand() % 3 -1; arr[x-i][y-j] } else if (x>0 && x<4 && y==0) { int k = rand() % 3 -1; int l = rand() ; arr[x-i] */ // 배 는 를 ... for(int i=0; i<5; i++) { for(int j=0; j<5; j++) { cout << arr[i][j] ; } cout << endl; } }