#include #include #include #include #include int a,b,c,d,e,f,g,h1,tedad=0; void main(void) { int gdriver = DETECT, gmode; // Active Graphic Mode initgraph(&gdriver, &gmode, "c://tc//bin"); int check( int, int, int); void draw_puzzle(void); setfillstyle(6, 1); bar(0,0,640,480); //Set BackGround for(a=0;a<8;a++) for(b=0;b<8;b++) if(check(a,b,1)) for(c=0;c<8;c++) if((check(c,b,1))&&(check(c,a,2))) for(d=0;d<8;d++) if((check(d,c,1))&&(check(d,b,2))&&(check(d,a,3))) for(e=0;e<8;e++) if((check(e,d,1))&&(check(e,c,2))&&(check(e,b,3)) &&(check(e,a,4))) for(f=0;f<8;f++) if((check(f,e,1))&&(check(f,d,2))&&(check(f,c,3)) &&(check(f,b,4))&&(check(f,a,5))) for(g=0;g<8;g++) if((check(g,f,1))&&(check(g,e,2))&&(check(g,d,3)) &&(check(g,c,4))&&(check(g,b,5))&&(check(g,a,6))) for(h1=0;h1<8;h1++) if((check(h1,g,1))&&(check(h1,f,2))&&(check(h1,e,3)) &&(check(h1,d,4))&&(check(h1,c,5))&&(check(h1,b,6)) &&(check(h1,a,7))) { ++tedad; draw_puzzle(); getch(); } } int check(int i, int j, int d) { if ((i==j)||(abs(i-j)==d)) return(0); else return(1); } void draw_puzzle(void) { unsigned char i,v; for(int j=0;j<8;++j) for(int k=0;k<8;++k) { if((k+j)%2==0) setfillstyle(1, 0); else setfillstyle(1, 15); bar(55*j+81,55*k+20,55*j+81+55,55*k+55+20); } for (i=0;i<8;i++) { switch(i) { case 0:{v=a;break;} case 1:{v=b;break;} case 2:{v=c;break;} case 3:{v=d;break;} case 4:{v=e;break;} case 5:{v=f;break;} case 6:{v=g;break;} case 7:{v=h1;break;} } setcolor(BLUE); outtextxy(55*(v+1)+35,55*(i+1)-12,"VAZIR"); gotoxy(30,30); cout<< "Table Number = "<