示例#1
0
文件: Gaming.c 项目: reAsOn2010/libs
int CheckWin(){
	if(bla != 0 && whi != 0 && count < 64){
		if(stopcheck == 0)
			return 1;
		else if(stopcheck == 1){
			if(bla > whi){
				cleardevice();
				outtextxy(320,210,"Black Win!");
				outtextxy(320,280,"Press any key to continue");
				return 0;
			}
			else if(bla < whi){
				cleardevice();
				outtextxy(320,210,"White Win!");
				outtextxy(320,280,"Press any key to continue");
				return 0;
			}
			else{
				cleardevice();
				outtextxy(320,210,"Tie to Tie!");
				outtextxy(320,280,"Press any key to continue");
				return 0;
			}
		}
	}
	else if(bla == 0 && whi != 0){
		cleardevice();
		outtextxy(320,210,"White Win!");
		outtextxy(320,280,"Press any key to continue");
		return 0;
	}else if(whi == 0 && bla != 0){
		cleardevice();
		outtextxy(320,210,"Black Win!");
		outtextxy(320,280,"Press any key to continue");
		return 0;
	}else if(count == 64){
		if(bla > whi){		
			cleardevice();
			outtextxy(320,210,"Black Win!");
			outtextxy(320,280,"Press any key to continue");
			return 0;
		}else if(bla < whi){
			cleardevice();
			outtextxy(320,210,"White Win!");
			outtextxy(320,280,"Press any key to continue");
			return 0;
		}else{
			cleardevice();
			outtextxy(320,210,"Tie to Tie!");
			outtextxy(320,280,"Press any key to continue");
			return 0;
		}
	}
}
示例#2
0
/*Player is asked to enter password. In place of the character entered by the player, asterixes are printed. The entered string is compared with set password. If the passwords match, player is granted access to the game*/
int getPassword()
{clrscr();
cleardevice();
int c=0,end=0,ch,i,j;
 char p[8];
 setcolor(7);
 setfillstyle(SOLID_FILL,BLUE);
 rectangle(10,BLUE,635,470);
 floodfill(15,60,WHITE);
 setcolor(9);
 setfillstyle(1,WHITE);
 rectangle(212,165,387,315);
 floodfill(200,200,9);
 char title[13];
 strcpy(title,"CONNECT FOUR");
 setcolor(RED);
 settextstyle(TRIPLEX_FONT,0,6);
 outtextxy(160,60,title);
 for(i=0;i<7;i++)
 for(j=0;j<6;j++)
	{setcolor(WHITE);
	setfillstyle(1,WHITE);
	fillellipse((i+1)*25+198,(j)*25+178,ray/2,ray/2);}
 for(i=1;i<=24;i++)
	{cout<<"\n";}
 for (i=1;i<=5;i++)
	{cout<<"\t";}
 setcolor (WHITE);
 setfillstyle(1,WHITE);
 bar(0,370,330,400);
 setcolor(BLACK);
 settextstyle(1,0,1);
 outtextxy(170,378,"Enter Password: "******"*";
	p[c]=ch;
	++c;
	ch=getch();}

end=0;
if (c>8)
	end=1;
else
       {for (i=0;i<8;i++)
		{if (p[i] != password[i])
			end=1;
		}
       }

if (end==1)
	return(1);
else
	return(0);
}
示例#3
0
文件: VRTOOL.C 项目: krattai/flosh
void newpos(void)
{
	cleardevice();
	x=0.0;y=0.0;z=0.0;
	sx=0.0;sy=0.0;
	xa=0.0;ya=0.0;za=0.0;
	sxa=0.0;sya=0.0;sxb=0.0;syb=0.0;
	sxs=0.0;sys=0.0;
	sr1=0.0;sr2=0.0;sr3=0.0;
	cr1=0.0;cr2=0.0;cr3=0.0;
	msx=0.0;msy=0.0;
	rx=0.0;ry=0.0;
	t1=0;t2=0;
	p1=0;
	rotation();
/*	for(t2=1;t2<=6;t2++) */
	for(t2=1;t2<=4;t2++)
	{
		setlinestyle(USERBIT_LINE,0xffff,NORM_WIDTH);

		/* get starting position */
/*		x=array1[p1][0];
		y=array1[p1][1];
		z=array1[p1][2]; */
		x=array2[p1][0];
		y=array2[p1][1];
		z=array2[p1][2];
		calc_3d();
		windows();
		sxa=sx;sya=sy;

		/* finish displaying side */
/*		for(t1=1;t1<=4;t1++) */
		for(t1=1;t1<=3;t1++)
		{
			p1++;
/*			x=array1[p1][0];
			y=array1[p1][1];
			z=array1[p1][2]; */
			x=array2[p1][0];
			y=array2[p1][1];
			z=array2[p1][2];
			calc_3d();
			windows();
			sxs=sx;
			sys=sy;
			sxb=sx;
			syb=sy;
			moveto(sxa,sya);
			lineto(sxb,syb);
			sxa=sxs;
			sya=sys;
		}
		p1++;
	}
}
示例#4
0
void obj_figura::muda()
{
  if (ctela.pagina_atual == 0)
  {
    setvisualpage(1);
    ctela.pagina_atual = 1;
    setactivepage(0);
    cleardevice();
    setactivepage(1);
  }
  else
    {
      setvisualpage(0);
      ctela.pagina_atual = 0;
      setactivepage(1);
      cleardevice();
      setactivepage(0);
    }
}
示例#5
0
int f8()
{
clrscr();
cleardevice();
int flag=44;
setbkcolor(3);
draw();
char m[20];
char a[20][20]={"2xqwer4fgi","trewq9y3ry","yuip7qtgfm","jpiuy9bph6","klkjh6decc","etlhjklo2k","lasdfapl4z","efghjv5qy","mmjnhlmt8t","134rfvup5n"};
randomize();
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 8");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nplease this is the last time!!!");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 8");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters you saw earlier");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0)

{
 flag=8;
}
else
 flag=-8;
return flag;
}
示例#6
0
int f7()
{
clrscr();
cleardevice();
setbkcolor(10);
draw();
int flag=44;
char m[20];
char a[20][20]={"2x4qwfegi","rtyt9y3ry","7uipqtgfm","j9bpasdh6","kfgh6decc","etljklo2k","lzxcapl4z","ev5vbnqy","mlkmlmt8t","13iuyup5n"};
randomize();
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 7");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nso far so good ");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 7");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0)

{
 flag=7;
}
else
 flag=-7;
return flag;
}
示例#7
0
int f6()
{
clrscr();
cleardevice();
setbkcolor(9);
int flag=44;
char m[20];
char a[20][20]={"2x4fgspi","tla9y3ry","bn7qtgfm","j9bph6aq","k6txdecc","eq8tlo2k","l19apl4z","xeskv5qy","mliet8tl","13up5zpn"};
randomize();
draw();
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 6");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nNow it should be difficult");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 6");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters you saw earlier");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0)

{
 flag=6;
}
else
 flag=-6;
return flag;
}
示例#8
0
int f5()
{
clrscr();
cleardevice();
setbkcolor(6);
int flag=44;
char m[20];
char a[20][20]={"2x4fg5i","ty9z3rx","7jqzgfx","j3nxph6","k6ds4rz","tv4o2bk","x7pal4z","evt5qyp","mz5xt8v","13up5nb"};
randomize();
draw();
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 5");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nCOME ON AGAIN!!!!!!!");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 5");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters you saw earlier");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0)

{
 flag=5;
}
else
 flag=-5;
return flag;
}
示例#9
0
int f4()
{
clrscr();
cleardevice();
setbkcolor(0);
int flag=44;
char m[20];
char a[20][20]={"2x4fgi","t9y3ry","7qtgfm","j3zph6","k6devc","exlo2k","zapx4z","ev5qy","5lxt8","13up5n"};
randomize();
int r=random(10)+1;
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 4");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nyou can do it again!!!");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++)
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 4");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters you saw earlier");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0)

{
flag=4;
}
else
flag=-4;
return flag;
}
示例#10
0
   int main()
   {
   int i;
    int gm;
    int gd=DETECT;
    initgraph(&gd,&gm,"");

int x=10;
int y=10;
int h=200;
int k=200;

while(1){
cleardevice();
hiosbox(x,y,h,k);



  int t=0;
   for(i=0;i<25;i++)
   {

       setcolor(i);
       hiosbox(x,y,h,k);
       if(i%5==0)t++;
       setcolor(3);
       fillellipse(x+h/3+i,y+k/6-i,h/50,k/50+t);
       barish(x,y,h,k);
       setcolor(i);
       delay(100);
   point p[4]={{x+rand()%h/6,y+rand()%k/6},{x+rand()%h/6,y+rand()%k/6},{x+rand()%h/6,y+rand()%k/6},{x+rand()%h/6,y+rand()%k/6}};
   point q[4]={{x+rand()%h/7,y+rand()%k/7},{x+rand()%h/7,y+rand()%k/7},{x+rand()%h/7,y+rand()%k/7},{x+rand()%h/7,y+rand()%k/7}};

   bezier(p);
   bezier(q);
       cleardevice();
   }
}
      getch();
      closegraph();


    }
示例#11
0
void main()
{   int gdriver = DETECT, gmode, errorcode;
    initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi");
    intro();
    levelmenu();
    clrscr();
    cleardevice();
    setbkcolor(RED);
    easy();
}
示例#12
0
void ComXia(long x,long y)
{
     long i,j;
	 move(x,y,now);
	 now = 1;
     nnx = x; nny = y;
	 cleardevice();
	 QiPan();
	 HuaNow(x,y);
}
示例#13
0
 void displaydata()
 {
	char *c;
	cleardevice();
	hidemouseptr();
	cleardevice();
	border();
	setcolor(GREEN);
	settextstyle(10,HORIZ_DIR,3);
	outtextxy(70,20,"LIST OF ACCOUNTS IN BANK");
	setcolor(LIGHTGRAY);
	line(8,95,getmaxx()-8,95);
	line(8,100,getmaxx()-8,100);
	settextstyle(1,HORIZ_DIR,1);
	outtextxy(15,120,"Acc.No.");
	outtextxy(150,120,"Name");
	outtextxy(300,120,"Address");
	outtextxy(500,120,"Balance");
 }
示例#14
0
//End of drawLegend routine
//This routine erases the graphics already drawn
void eraseGraphics()
{
	//Erases the graphics already drawn
	cleardevice();
	//Sets fill & drawing colors
	setcolor(GREEN);
	setfillstyle(SOLID_FILL, GREEN);
	//Fills the graphics window with a green
	floodfill(0, 0, GREEN);
}
示例#15
0
文件: ball.c 项目: swathisk/trygit
void main()										//Main function
{

	int gd=DETECT,gm=VGAMAX;
	float i,j,xr,xy,x,y;
	initgraph(&gd,&gm,0);
	int a[]={50,100,100,100,100,150,150,150,150,200,200,200,200,250,250,250,250,300,300,300,300,350,50,350,50,100};
	
	fillpoly(13,a);								//Draw polygon
	
	setcolor(RED);
	pieslice(75,75,0,360,25);
	xr=75;xy=75;
	delay(100);
	
	for(j=0;j<5;j++)
	{
	x=xr+25;y=xy;
	for(i=180;i<=360;i++)
	{	
		cleardevice();
		setcolor(WHITE);
		fillpoly(13,a);
		setcolor(RED);
		pieslice(x+25*cos(i*3.14/180),y+25*sin(i*3.14/180),0,360,25);
		delay(10);
		xr=x+25*cos(i*3.14/180);
		xy=y+25*sin(i*3.14/180);
	}
	for(i=0;i<50;i++)
	{	
		xy++;
		cleardevice();
		setcolor(WHITE);
		fillpoly(13,a);
		setcolor(RED);
		pieslice(xr,xy,0,360,25);
		delay(10);
	}
	}
	getch();
	closegraph();								//close graph
}
示例#16
0
 void menu()
 {
 int opt,style,size=2,x,y;
 while(1)
 {
 cleardevice();

	 style = TRIPLEX_FONT;
/* select the text style */

settextstyle(style, HORIZ_DIR, size);

// outtext("student record project");
 outtextxy(200,200," 1.new record");
   setcolor(4);


 outtextxy(220,220,"\n 2.modification in record");
   setcolor(5);

 outtextxy(240,240,"\n 3.delete record");
   setcolor(6);

 outtextxy(260,260,"\n 4.display");
 setcolor(7);

 outtextxy(280,280,"\n 8.exit");
 setcolor(8);

 outtextxy(300,300,"\n option ");
 setcolor(9);
 scanf("%d",&opt);
 if(opt>7||opt<0)
 break;
 else

	switch(opt)
 {
	case 1:
	add();
	break;
	case 2:
	modrec();
	break;
	case 4:
	display();
	break;
	case 3:
	delrec();
	break;
 }
 getch();
 return;
 }
}
示例#17
0
int main (int argc, char **argv)
{
  int gd, gm;
  int col;
  unsigned int seed;
  long int counter;
  float j, k, x, y, xx, xp, yp, r, xoffs, yoffs;
  
  if (argc == 2)
    seed = atoi (argv [1]); /* no checks! */
  else {  
    printf ("Seed: ");
    j = scanf ("%d", &seed);
  }
  srand (seed);
  // random each time:
  // srand (time(NULL));
  
  gd = X11;
  gm = getmaxmode ();
  initgraph(&gd, &gm, "");
  
  setbkcolor (BLACK);
  cleardevice ();
  setcolor (YELLOW);
  outtextxy (0, 0, "Press a key or click to exit: ");
  
  xoffs = getmaxx () / 2;
  yoffs = getmaxy () / 3;
  j = random (100);
  k = random (100);
  x = y = xx = xp = yp = r = 0.0;
  col = 1; /* colours codes run from 0 (black) to 15 (white) */
  counter = 0;
  setcolor (col);

  while (!kbhit () && !mouseclick ()) {
    xx = y - sgn (x) * sqrt (abs (k * x - 1));
    y = j - x;
    x = xx;
    xp = x * 2 + xoffs;
    yp = y * 2 + yoffs;
    _putpixel (xp, yp);
    if (++counter == 20000) {
      counter = 0;
      col++;
      if (col == 16)
	col = 1;
    }
    setcolor (col);
  }
   
  closegraph ();
  return 0;
}
示例#18
0
int f1()
{
clrscr();
setbkcolor(4);
cleardevice();
draw();
int flag=44;
char m[20];
char a[20][4]={"x4i","ty3","qtm","j6b","k9c","t0k","p4z","v5y","l8t","1p5"};
randomize();    //to select anyone string randomly
int r=random(10)+1;
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 1");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100,"\nNow try to remember these letters");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
for(int i=0;a[r][i]!='\0';i++) //to display letters one by one
{
 cout<<a[r][i];
 td();
 cout<<" ";
 td();
}
clrscr();
cleardevice();
draw();
settextstyle(SCRIPT_FONT, HORIZ_DIR, 5);
outtextxy(190,0,"level 1");
line(190,60, 300, 60);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 3);
outtextxy(0,100," please type the letters you saw earlier");
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"\t";
gets(m);
if(strcmpi(m,a[r])==0) //to compare the input with the displayed string
flag=1; //if input is correct
else if(strlen(a[r])==0)
flag=101;//if nothing if accepted
else
flag=-1; //if input is incorrect
return flag;
}
示例#19
0
main()
{
  int size;
  int i=0;
  int key;
  int station;
  InstallGraph();
  setbkcolor(BLACK);
  cleardevice();
  setcolor(BLUE);
  outtextxy(80,100,"Ready!...Any key to SET OFF!!!");
  DrawGun();
  getch();
  cleardevice();
  DrawGun();
  DrawPlan();
  DrawStar();
  setcolor(LIGHTRED);
  do
  {
     putimage(x0-width2,y0-height-3*width1-i,buf,XOR_PUT);
     i+=2;
     putimage(x0-width2,y0-height-3*width1-i,buf,XOR_PUT);
     key=getch();
     if(y0-height-3*width1-i==0)
        outtextxy(60,100,"Successfullly!!!Press ESC to quit");
     if(key==ESC)
     {
        if(y0-height-3*width1-i>0)
        {
           cleardevice();
           outtextxy(100,100,"Failure.What did you do?");
           outtextxy(130,130,"Press any key to quit.");
           getch();
        }
     }
  }
  while(key!=ESC);
  free(buf);
  closegraph();
  return 0;
}
示例#20
0
void clip_poly_menu() {
    cleardevice();
    std::vector<Point2D> p1, p2;

    outtext((char*)"Define the Polygon Window");
    outtextxy(0, 25, (char*)"Left click mouse to add points to polygon and right click to finish adding points");
    std::cout<<"\nPolygon1";
    p1 = mk_poly();

    cleardevice();

    setcolor(RED);
    mypoly(p1);

    outtext((char*)"Define the Polygon to be Clipped");
    std::cout<<"\nPolygon2";
    p2 = mk_poly();

    clip_poly(p1, p2);
}
示例#21
0
void fire(int x , int y)
{ setcolor(5);
  for(int i=0;i<150;i++)
  { cleardevice();
    circle(x,y+150-i,4);
    circle(x,y+150-i,3);
    circle(x,y+150-i,2);
    delay(1);
  }

 }
示例#22
0
main()
{
  int gdriver=DETECT,gmode;
   initgraph(&gdriver,&gmode,"");
   speed=Speed();/*将函数返回值赋给speed*/
   cleardevice();/*清屏*/
   dwall();/*开始画墙*/
   Play();/*开始完游戏*/
   getch();
   closegraph();/*退出图形界面*/
}
示例#23
0
void main()
{
 int gdriver = DETECT, gmode;
 initgraph(&gdriver, &gmode, "\\tc\\bgi");
 cleardevice();

 hand();

 getch();
 closegraph();
}
示例#24
0
void PressMouse(long x,long y)
{
     if(map[y][x] != 0) return ;

     map[y][x] = 1;
	 now = 2;

     cleardevice();
	 QiPan();
	 HuaNow(x,y);
}
示例#25
0
void make_m_icon()
{
   cleardevice();
   //setcolor(15);
   int t[14];
   t[0]=0; t[1]=20;
   t[2]=30; t[3]=20;
   t[4]=30; t[5]=0;
   t[6]=40; t[7]=30;
   t[8]=30; t[9]=60;
   t[10]=30; t[11]=40;
   t[12]=0; t[13]=40;
   setfillstyle(1,10);
   fillpoly(7, t);
   msize = imagesize(0,0,40,60);
   micon = malloc(msize);
   getimage(0,0,40,60,micon);
   setcolor(15);
   cleardevice();
}
示例#26
0
void PressMouse(long x,long y)
{
     if(map[y][x] != 0) return ;

     move(x,y,now);
	 now = now%2 +1;
   
     cleardevice();
	 QiPan();
	 HuaNow(x,y);
}
示例#27
0
文件: WORK.CPP 项目: paraler/bashrc
void runkernel(void)
{
	cleardevice();
	setbkcolor(0);

	int id,l,count=0;
	Control.First=0;
	Control.Free=50;
	id=Number+1;
	while((Control.Free<50)||(Number==-1))
	{
		while(bioskey(1)!=0)
		{
			count++;
			bioskey(0);
			biuldwait(id);
			id++;
			Number++;
		}
		if((wt==wh&&wh==0)||(wt!=wh))	biuldmem();/*Biuld all can*/
		cleardevice();
		setbkcolor(0);
		drawgrid();
		run();
		finish();
		compress();
		display();
		delay(2000);
	}
	setcolor(0);
	for(int a=0;a<629;a++)
	{
		moveto(a,390);
		lineto(a,425);
		moveto(a,445);
		lineto(a,460);
	}
	setcolor(YELLOW);
	outtextxy(180,450,"All the processes have been done!");
	getch();
}
示例#28
0
void main()
{
int driver,mode;
int errorcode;
int p0,p;
driver=DETECT;
initgraph(&driver,&mode,"c:\\tc\\bin");
errorcode=graphresult();
if(errorcode!=grOk)
{
cout<<"\nerror opening the graphics mode :";
cout<<"\npress any key to halt :";
getch();
exit(1);
}
cout<<"\nenter the 'x' coordinate of center :";
cin>>xc;
cout<<"\nenter the 'y' coordinate of center :";
cin>>yc;
cout<<"\nenter the radius of circle :";
cin>>r;
cleardevice();
xcc=getmaxx()/2;
ycc=getmaxy()/2;
x=0;
y=r;
p0=1-r;
p=p0;
line(0,getmaxy()/2,getmaxx(),getmaxy()/2);
line(getmaxx()/2,0,getmaxx()/2,getmaxy());
outtextxy(10,10,"By Mid-point circle algorithm");
line(10,20,250,20);
outtextxy(xcc+xc-20,ycc-yc+10,"(xc,yc)");
while(x<y)
{
if(p<0)
{
x=x+1;
delay(50);
plotpixel();
p=p+(2*x)+1;
}
else
{
x=x+1;
y=y-1;
delay(50);
plotpixel();
p=p+(2*x)+1-(2*y);
}}
getch();
closegraph();
}
示例#29
0
void main(void)
 {
   int  dr = DETECT, mode, errorcode;
   int r1,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12;
   clrscr();
   initgraph(&dr, &mode, "f:\\comp\\c\\bc\\bgi");
   errorcode = graphresult();
   if (errorcode != 0) {
   printf(" graphics Error :%s\n", grapherrormsg(errorcode));
   exit(1);
   }
/*   for(r1=0;r1<15;++r1){*/

   setcolor(4);
   setbkcolor(1);
   i2=0;
   i1=30;
  /* i3=100;
   i4=100;
   i5=150;
   i6=350;
   i7=390;
   i8=400;
   i9=500;
   i10=220;
   i11=340;
   i12=0;         */


  while(i2<220) {

    ++i2;
/*   ++i3;
   --i4;
   ++i5;
   --i6;
   --i7;
   --i8;
   --i9;
   ++i12;
   cleardevice();
int i[12] = {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 };
   drawpoly(6, i);    */
   cleardevice();
   outtextxy(i1,i2,     "                      ö‘þ‘•");
   outtextxy(i1,(i2+40),"¢þøª üõ š¤‘¡ ô—¨þ¨ ¥� öø÷î�");
   outtextxy(i1,(i2+80),"                 ¤�¢úð÷ �¢¡");
   settextstyle(0,0,2);
    }

   getch();
   closegraph();
   }
示例#30
0
void PolyLine()
{
	int iCnt;
	cleardevice();
	line(0,240,640,240);
	line(320,0,320,480);
	for (iCnt=0; iCnt<4; iCnt++)
	{
		line(PolygonPoints[iCnt][0],PolygonPoints[iCnt][1],
		  PolygonPoints[(iCnt+1)%4][0],PolygonPoints[(iCnt+1)%4][1]);
	}
}