コード例 #1
0
ファイル: gr.cpp プロジェクト: bdumitriu/playground
main()
{
   int drv= DETECT, mod_g;

   if ((f= fopen("gr.in", "r")) == NULL)
   {
      printf("Eroare la deschiderea fisierului !");
      getch();
      return 0;
   }
   i= 0;
   while (!feof(f))
   {
      i++;
      fscanf(f, "%i %i %i %i\n", &x1[i], &y1[i], &x2[i], &y2[i]);
   }
   fclose(f);
   initgraph(&drv, &mod_g, "c:\\bc31\\bgi");
   setbkcolor(WHITE);
   cleardevice();
   setcolor(YELLOW);
   setwritemode(XOR_PUT);
   for (j= 1; j <= i; j++)
   {
      if (x1[j] != x2[j])
      {
	 a1= (float(y2[j]-y1[j]))/(float(x2[j]-x1[j]));
	 a2= (float(x1[j])*float(y2[j])-float(y1[j])*float(x2[j]))/(x2[j]-x1[j]);
	 i1= -float(a2);
	 i2= (float(a1)*float(getmaxx()))-float(a2);
	 for (x= 0; x <= getmaxx(); x++)
	 {
	    j1= (float(a1)*float(x))-float(a2);
	    line(x, j1, x, 0);
	 }
      }
      else
	 for (x= 0; x <= getmaxy(); x++)
	    line(x1[j], x, getmaxx(), x);
   }


   getch();
   return 0;
}
コード例 #2
0
void main()
{
int gd=DETECT,gm;
int r,x,y,p,xc=320,yc=240;

initgraph(&gd,&gm,"C:\\TC\\BGI");
cleardevice();


printf("Enter the radius ");
scanf("%d",&r);


x=0;
y=r;
putpixel(xc+x,yc-y,1);

p=3-(2*r);

for(x=0;x<=y;x++)
{
if (p<0)
{
y=y;
p=(p+(4*x)+6);
}
else
{
y=y-1;

p=p+((4*(x-y)+10));
}

putpixel(xc+x,yc-y,1);
putpixel(xc-x,yc-y,2);
putpixel(xc+x,yc+y,3);
putpixel(xc-x,yc+y,4);
putpixel(xc+y,yc-x,5);
putpixel(xc-y,yc-x,6);
putpixel(xc+y,yc+x,7);
putpixel(xc-y,yc+x,8);

}
getch();
closegraph();
コード例 #3
0
ファイル: FREEHAND.CPP プロジェクト: pjmodi/projects
void main()
{
int gd=DETECT,gm,maxx,maxy,x,y,button,prevx,prevy;

initgraph(&gd,&gm,"d:\\tc\\bgi");

printf("Freehand drawing  with the mouse");

maxx=getmaxx();
maxy=getmaxy();
rectangle(0,0,maxx,maxy);
setviewport(1,1,maxx-1,maxy-1,1);

if(initmouse()==0)
	{
	closegraph();
	restorecrtmode();
	printf("Mouse driver not loaded");
	exit(1);
	}

restrictmouseptr(1,1,maxx-1,maxy-1);
showmouseptr();

while(!kbhit())
	{
	getmousepos(&button,&x,&y);
	if((button & 1)==1)
		{
		hidemouseptr();
		prevx=x;
		prevy=y;

		while((button & 1)==1)
			{
			line(prevx,prevy,x,y);
			prevx=x;
			prevy=y;
			getmousepos(&button,&x,&y);
			}

		showmouseptr();
		}
	}
}
コード例 #4
0
ファイル: bresh1.cpp プロジェクト: guluuu3/spoj
int main()
{
int x1,x2,y1,y2;
char clr;
int gd=DETECT,gm;
void linebres(int,int,int,int,int);
printf("Enter the initial coordinate points:");
scanf("%d%d",&x1,&x2);
printf("Enter the end coordinate points:");
scanf("%d%d",&y1,&y2);
printf("Choose the colour ...valuse from (0-15)");
scanf("%d",&clr);
initgraph(&gd,&gm,"");
cleardevice();
linebres(x1,y1,x2,y2,clr);
getch();
closegraph();
}
コード例 #5
0
ファイル: dgraphic.cpp プロジェクト: dvorka/naaga
int DGraphics::Init( int gmode )
{
 int gdriver = VGA,
     errorcode;

 gdriver=installuserdriver("SVGA256",NULL);
 initgraph(&gdriver, &gmode, "");

 if ( (errorcode = graphresult()) != grOk )
  {
    cout << "Error: Graphics - %s\n" << grapherrormsg(errorcode);
    return FALSE;
  }

 ActiveMode=gmode;

 return TRUE;
}
コード例 #6
0
ファイル: VRTOOL.C プロジェクト: krattai/flosh
void graphics_setup(void)
{
	int graphics_adapter,gr_mode;

	graphics_adapter=VGA;gr_mode=VGAHI;
	initgraph(&graphics_adapter,&gr_mode,"");
	x_res=640;
	y_res=480;
	mode_flag=1;
	maxx=639;
	minx=0;
	maxy=479;
	miny=0;
	screen_x=639;
	screen_y=479;
	setcolor(7);
	return;
}
コード例 #7
0
void main()
{
    int     driver = DETECT,mode;
    int     i;

    initgraph(&driver,&mode,"c:\\borlandc\\bgi");
    line(100,100,500,100);
    for ( i = 20; i < 300; i++ )
	if ( getpixel(300,i) == WHITE )
	{
	   setcolor(BLUE);
	   circle(300,i,5);
	}
	else
	   putpixel(300,i,WHITE);
    getch();
    closegraph();
}
コード例 #8
0
void main()
{
int gdriver=DETECT,gmode;
int x0,y0,x1,y1,x2,y2,x3,y3,xt,yt;
float t;
initgraph(&gdriver,&gmode,"C:\\TC\\BGI");
clrscr();
printf("Enter the control points");
scanf("\n%d%d%d%d%d%d%d%d",&x0,&y0,&x1,&y1,&x2,&y2,&x3,&y3);
for(t=0.1;t<=0.9;t+=0.1)
{
xt=x0*pow((1-t),3)+3*x1*t*pow((1-t),2)+3*x2*t*t*(1-t)+x3*pow(t,3);
yt=y0*pow((1-t),3)+3*y1*t*pow((1-t),2)+3*y2*t*t*(1-t)+y3*pow(t,3);
putpixel(xt,yt,RED);
}
getch();
closegraph();
}
コード例 #9
0
ファイル: TREE.CPP プロジェクト: pjmodi/projects
main( )
{ 

int gd = DETECT, gm ;
int drawtree ( int x1, int y1, float a, float l, float f, int n ) ;
initgraph ( &gd, &gm, "d:\\tc\\bgi" ) ;

 

drawtree ( 280, 350, 270, 60, 90, 6 ) ;

 

getch( ) ;
closegraph( ) ;
restorecrtmode( ) ;

}
コード例 #10
0
ファイル: P375.CPP プロジェクト: agudeloandres/C_Struct_Files
int main() {
	int unidad = 0,modo;

	initgraph (&unidad,&modo,"c:\\bc\\bgi");
	if (graphresult() != 0) {
		cout << "Error al tratar de pasar al modo grafico\n";
		getch();
		return 1;
	}
	moveto(20,20);
	outtext ("p  r  u  e  b  a");
	setviewport (100,100,400,400, 1 );
	getch();
	cleardevice();
	getch();
	closegraph();
	return 0;
}
コード例 #11
0
int main()
{
	initgraph( 640, 480 );
	setrendermode(RENDER_MANUAL);
	PIMAGE img = newimage();
	getimage(img, "F://Pictures//12264878375.jpg");
	double r = 0;
	fps f;
	for ( ; is_run(); delay_fps(6000) )
	{
		r += 0.02;
		if (r > PI * 2) r -= PI * 2;

		cleardevice();
		putimage_rotatezoom(NULL, img, 320, 240, 0.5f, 0.5f, r, 0.5f, 0, -1, 1);
	}
	return 0;
}
コード例 #12
0
ファイル: P1-1.C プロジェクト: weimingtom/old_books_code
main()
{
	int shape[10] = {
		 50,  50,
		100, 150,
		200, 150,
		350,  90,
		 50,  50
	};
	int driver, mode;
	driver = DETECT;
	initgraph(&driver, &mode, ""),
	setbkcolor(CYAN);
	setcolor(RED);
	drawpoly(5, shape);
	getch();
	restorecrtmode();
}
コード例 #13
0
ファイル: diode.c プロジェクト: jakkanikiran/C-programs
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");

line(100,100,100,200);  //Vertical Line
line(70,150,100,150);   //Middle Line Dividing Vertical Line

line(100,100,150,150);  //Slant Line From Top to Bottom
line(100,200,150,150);  //Slant Line From Bottom to Top

line(150,100,150,200);  //Vertical Line

line(150,150,250,150);  //Horizontal Line

getch();
closegraph();
}
コード例 #14
0
ファイル: FILLSTYL.CPP プロジェクト: pjmodi/projects
void main()
{
int gd=DETECT,gm,maxx,maxy,x=40,y=40,fst;
char str[40];
char *pattern[]={
		"EMPTY_FILL","SOLID_FILL","LINE_FILL",
		"LTSLASH_FILL","SLASH_FILL",
		"BKSLASH_FILL","LTBKSLASH_FILL",
		"HATCH_FILL","XHATCH_FILL",
		"INTERLEAVE_FILL","WIDE_DOT_FILL",
		"CLOSE_DOT_FILL","USER_FILL"
		};

initgraph(&gd,&gm,"d:\\tc\\bgi");

maxx=getmaxx();
maxy=getmaxy();
rectangle(0,10,maxx,maxy);

setcolor(WHITE);
outtextxy(175,0,"Pre-defined Fill Styles");

for(fst=0;fst<12;fst++)
	{
	setfillstyle(fst,LIGHTRED);
	bar(x,y,x+80,y+80);
	rectangle(x,y,x+80,y+80);

	itoa(fst,str,10);
	outtextxy(x,y+100,str);
	outtextxy(x,y+110,pattern[fst]);

	x=x+150;
	if(x>490)
		{
		y=y+150;
		x=40;
		}
	}

getch();
closegraph();
restorecrtmode();
}
コード例 #15
0
int main(){
	int dx,dy,x,y,p,x1,y1,x2,y2;
	int gd,gm;

	printf("Enter the value of x1 : ");
	scanf("%d",&x1);
	printf("Enter the value of y1 : ");
	scanf("%d",&y1);
	printf("Enter the value of x2 : ");
	scanf("%d",&x2);
	printf("Enter the value of y1 : ");
	scanf("%d",&y2);

	dx = x2 - x1;
	dy = y2 - y1;

	p = 2 * dy - dx;

	x = x1;
	y = y1;

	detectgraph(&gd,&gm);
	initgraph(&gd,&gm,"");
	setbkcolor(WHITE);
	putpixel(x,y,0);

	while(x <= x2){
		if(p < 0){
			x=x+1;
			y=y;
			p = p + 2 * (dy);
		}
		else{
			x=x+1;
			y=y+1;
			p = p + 2 * (dy - dx);
		}
		putpixel(x,y,0);
	}

	getch();
	closegraph();

}
コード例 #16
0
ファイル: MADHUR1.C プロジェクト: akreddysoft/CollegeCode
int main()
{
	int i,j,k,framenum=0;
	int gd=DETECT,gm,retval;
	char *frame="1";
	initgraph(&gd,&gm,"f:\\tc\\bgi");
	i=graphresult();
	if(i!=0)
	{
		printf("\nGraphics Error\n");
		exit(1);
	}

	rectangle(10,10,100,420);
	rectangle(530,10,630,420);
//	outtextxy(530,200,"Receiver");
	count=INITY;
	while(count<400)
	{
		outtextxy(100-10,count,frame);
		drawline(100,530,1);
		framenum=atoi(frame);
		count=count+GAP;
/////////////////////
		retval=wait(30,count);
		if(retval==1)
		{
			framenum++;
			itoa(framenum,frame,10);
			drawline(530,100,0);
			count=count+GAP;
		}
		else
		{
			//resend the frame
			outtextxy(100-10,count,frame);
			drawline(100,530,1);
		}
	}

	getch();
	closegraph();
	return 0;
}
コード例 #17
0
ファイル: t09.cpp プロジェクト: AlexiaChen/ConnectFive
int main()
{
	//声明一个img图片对象
	PIMAGE img;

	initgraph(640, 480);

	//先随便画一些东西
	setcolor(EGERGB(0xFF, 0xFF, 0x0));
	setfillcolor(EGERGB(0xFF, 0x0, 0x80));
	fillellipse(50, 50, 50, 50);

	//用newimage在initgraph后创建这个对象。但记得要在不使用的时候delimage
	img = newimage();

	//从屏幕上截取(0, 0) - (80, 60)这部分作为img,这个img大小为80*60
	//img的尺寸会重设,大小由第三第四个参数决定
	//注意,(0,0)这点会被包含在img里,但(80, 60)不包含
	getimage(img, 0, 0, 80, 60);

	//对img设置填充色为绿色
	setfillcolor(EGERGB(0x0, 0x70, 0x0), img);

	//对img画实心矩形
	bar(40, 20, 70, 50, img);

	int x, y;
	//把img平铺在屏幕上,使用一个二重循环
	for (y = 0; y < 8; ++y)
	{
		for (x = 0; x < 8; ++x)
		{
			//把img整个,画在指定的坐标上,左上角对齐这个坐标
			putimage(x * 80, y * 60, img);
		}
	}

	getch();

	delimage(img);

	closegraph();
	return 0;
}
コード例 #18
0
ファイル: main.cpp プロジェクト: LubisSucipto/tubes-grafika
int main() {
    int gdriver = DETECT, gmode, errorcode;
    initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
    int ch; 
    int p = 60;
    int l = 60;
    int xc = getmaxx() / 2;
    int yc = getmaxy() - 60;
    
    Car cars(xc,yc,p,l);
    


    while(1) {                                                              //infinite loop              
       cars.draw();
       // outtextxy(400,400,"Press Esc to Exit.....");
        if(kbhit())                                            //check if a key is pressed
        {
            ch=getch();

            if(ch==75)      //move left
            {
                cars.moveLeft();

            }

            if(ch==77)      //move right
            {
                cars.moveRight();
            }


            if(ch==27)     //exit when esc pressed
                break;


        delay(5);
        cleardevice();
        }
                    
    }

    return 0;
}
コード例 #19
0
ファイル: MOUSE1.C プロジェクト: AbhishekRaval/Graphics
void main()
{
	int gd=DETECT,gm,maxx,maxy,x,y,button;

	initgraph(&gd,&gm,"c:\\tc\\bgi");
	maxx=getmaxx();
	maxy=getmaxy();

	rectangle(0,56,maxx,maxy);
	setviewport(1,57,maxx-1,maxy-1,1);
	gotoxy(26,1);
	printf("Mouse Demonstration Program!");

	if(initmouse()==0)
	{
		closegraph();
		restorecrtmode();
		printf("Mouse driver not loaded");
		exit(1);
	}
	restrictmouseptr(1,57,maxx-1,maxy-1);
	showmouseptr();
	gotoxy(1,2);
	printf("Left Button");
	gotoxy(15,2);
	printf("Right Button");
	gotoxy(55,3);
	printf("Press any key to exit");

	while(!kbhit())
	{
		getmousepos(&button,&x,&y);

		gotoxy(5,3);
		(button&1)==1 ? printf("DOWN"):printf("UP");

		gotoxy(20,3);
		(button&2)==2 ? printf("DOWN"):printf("UP");

		gotoxy(65,2);
		 printf("X=%03d y=%03d",x,y);

	}
}
コード例 #20
0
ファイル: Main.cpp プロジェクト: kevinzhang2012/AI
int main(int argc, char *argv[]) {	
	char gridFileName[80];
	if (argc == 3){
		strcpy(gridFileName, argv[1]);
        
		if (!strcmp(argv[2], "EUCLIDEAN")){
			HEURISTIC = EUCLIDEAN;			
			cout << "Heuristics = EUCLIDEAN" << endl;
		}
		else if (!strcmp(argv[2], "MANHATTAN")){
			HEURISTIC = MANHATTAN;
			cout << "Heuristics = MANHATTAN" << endl;
		}	
	} else {
		cout << "missing parameters:  gridworld heuristic" << endl;
	}
	
	int graphDriver = 0,graphMode = 0;
 	
	//initgraph(&graphDriver, &graphMode, "", 1440, 900); // Start Window
 	//initgraph(&graphDriver, &graphMode, "", 1280, 1024); // Start Window
	
   initgraph(&graphDriver, &graphMode, "", 1360, 768); // Start Window - LAPTOP SCREEN
	//initgraph(&graphDriver, &graphMode, "", 1920, 1080); // Start Window - Full-HD
	
	BACKGROUND_COLOUR = WHITE;
	LINE_COLOUR = GREEN;
	
	GRIDWORLD_ROWS = 0; //7; //6; //duplicated in GridWorld
   GRIDWORLD_COLS = 0; //15;//13; //duplicated in GridWorld
	SHOW_MAP_DETAILS=false;

   try{
		runSimulation(gridFileName);
   }
	
   catch(...){
    	cout << "Exception caught!\n";
   }
	
	cout << "----<< The End.>>----" << endl;
	
	return 0;
} 
コード例 #21
0
int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int style, midx, midy;
   int size = 1;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   midx = getmaxx() / 2;
   midy = getmaxy() / 2;

   settextjustify(CENTER_TEXT, CENTER_TEXT);

   /* loop through the available text styles */
   for (style=DEFAULT_FONT; style<=GOTHIC_FONT; style++)
   {
      cleardevice();
      if (style == TRIPLEX_FONT)
         size = 4;

      /* select the text style */
      settextstyle(style, HORIZ_DIR, size);

      /* output a message */
      outtextxy(midx, midy, fname[style]);
      getch();
   }

   /* clean up */
   closegraph();
   return 0;
}
コード例 #22
0
ファイル: WAVE3.C プロジェクト: akreddysoft/CollegeCode
void main()
{
 const l1=80,l2=240,l3=360;
 const linecolor=YELLOW,barcolor=LIGHTCYAN;
 int gd = DETECT,gm;
 float w,f,t,a,y,interval=20,width=10;
 int i,x1=0;
 printf("\nEnter the frequency:");
 scanf("%f",&f);
 printf("\nEnter the amplitude:");
 scanf("%f",&a);
 printf("\nEnter the sampling interval:");
 scanf("%f",&interval);
// printf("\nEnter the width:");
// scanf("%f",&width);
 w=2*3.14*f;
 t=0.1;
 initgraph(&gd,&gm,"e:\\tc\\bgi");
 line(0,l1,639,l1);    //x axis
 line(0,l2,639,l2);
 line(0,l3,639,l3);
 line(0,0,0,479);         //y axis
 for(i=0;i<640;++i)
 {
  y=a*sin(w*t);
  putpixel(i,l1+y,YELLOW);
  setcolor(barcolor);
  rectangle(x1,l2,x1+width,l2-a);
//  line(x1,l2,x1,l2-a);

  putpixel(i,l3+y,YELLOW);
  if(x1==i)
  {
	  setcolor(barcolor);
	  rectangle(x1,l3,x1+width,l3+y);
//	  line(x1,l3,x1,l3+y);
	  x1=x1+interval;
  }
  t=t+.1;
  delay(5);
 }
 getch();
 closegraph();
}
コード例 #23
0
ファイル: 257.c プロジェクト: Huericiz/C_lg_small_examples
main()
{
  int x,y,r=70,r1;
  double a;
  int gdriver=DETECT,gmode;
  initgraph(&gdriver,&gmode,"");
  cleardevice();
  setbkcolor(WHITE);
  setcolor(RED);
  for(a=0;a<2*PI;a+=PI/30)
  {
    x=320+r*cos(a);
    y=240-r*sin(a);
    r1=sqrt((x-320)*(x-320)+(y-240+r)*(y-240+r));
    circle(x,y,r1);
  }
  getch();
  closegraph();
}
コード例 #24
0
void draw_cube(double edge[20][3])
      	{
        initgraph(&gd,&gm,"..\bgi");
	int i;
	clearviewport();
	for(i=0;i<19;i++)
	      	{
	       	x1=edge[i][0]+edge[i][2]*(cos(2.3562));
	       	y1=edge[i][1]-edge[i][2]*(sin(2.3562));
	       	x2=edge[i+1][0]+edge[i+1][2]*(cos(2.3562));
	       	y2=edge[i+1][1]-edge[i+1][2]*(sin(2.3562));
		line(x1+320,240-y1,x2+320,240-y2);
	     	}
	line(320,240,320,25);
	line(320,240,550,240);
	line(320,240,150,410);
	getch();
     	closegraph();
     	}
コード例 #25
0
ファイル: NQuene.cpp プロジェクト: AssaultKoder95/codejam
void initialize_graphics(int& max_x, int& max_y)
{
	/*
	initialize_graphics() function initializes the graphic enviroment.
	*/
	int gdriver = DETECT, gmode, errorcode;
	initgraph(&gdriver, &gmode, "E:\\tc\\bgi");
	/* read result of initialization */
	errorcode = graphresult();
	if (errorcode != grOk)  /* an error occurred */
	{
		printf("Graphics error:",grapherrormsg(errorcode));
		printf( "Press any key to halt:");
		getch();
		exit(1); /* terminate with an error code */
	}
	max_x = getmaxx();
	max_y = getmaxy();
}
コード例 #26
0
ファイル: GRAPH.CPP プロジェクト: RashaveraQ/RNN
void ginit()
{
	/* 自動検出を要求 */
	int gdriver = DETECT, gmode, errorcode;

	/* グラフィックスシステムの初期化 */
	initgraph(&gdriver, &gmode, "c:\\bc4\bgi");

	/* 初期化の結果を取得 */
	errorcode = graphresult();

	if (errorcode != grOk)  /* エラーが発生したか? */
	{
		printf("Graphics error: %s\n", grapherrormsg(errorcode));
		printf("Press any key to halt:");
		getch();
		exit(1);             /* エラーとして終了 */
	}
}
コード例 #27
0
ファイル: Animate.cpp プロジェクト: yeskarthik/Project-Shark
void main(void)
{
   clrscr();
   int gdriver=DETECT,gmode;
   initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
   int x=0,y=0,r=0,b=0,color=0,midx,midy,maxx,maxy;
   midx=getmaxx()/2;
   midy=getmaxy()/2;
   maxx=getmaxx();
   maxy=getmaxy();
    rectangle(0,0,maxx,maxy);
   do
   {

      delay(10);
      setcolor(color);
      setbkcolor(0);
      arc(midx,midy,999,r,40);
      arc(midx,midy,999,r,42);
      arc(midx,midy,999,r,44);
      arc(midx,midy,999,r,46);
      arc(midx,midy,999,r,48);
      arc(midx,midy,999,r,50);
      arc(midx,midy,999,r,52);
      arc(midx,midy,999,r,54);
      arc(midx,midy,999,r,56);
      arc(midx,midy,500,r,70);
      arc(midx,midy,500,r,72);
      arc(midx,midy,500,r,74);
      arc(midx,midy,500,r,76);
      arc(midx,midy,500,r,78);
      arc(midx,midy,500,r,80);
      moveto(midx-20,midy);
      outtext("WE thank");
      x++;
      y++;
      r++;
      color++;
   }
   while( !kbhit() );
   getch();
   closegraph();
}
コード例 #28
0
void main()
{
   int gd=DETECT,gm;
   initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
   Display x;
   
   x.draw_car(160,200);
   x.draw_car(460,200);
   getch();
   
   x.erase_car(160,200);
   x.erase_car(460,200);
   cout<<"Car Erased.";
   getch();
   x.draw_car(160,40);
   x.draw_car(460,40);
   getch();
  
}
コード例 #29
0
ファイル: BRECIRFI.C プロジェクト: isequal2/graphics_editor
 main()
 {
 int xc,yc,r,a,b;
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"C:\\TC\\BGI");
 a=getmaxx();
 b=getmaxy();
 setcolor(RED);
 line(a/2,0,a/2,b);
 line(0,b/2,a,b/2);
 printf("Enter the Center and radius");
 scanf("%d%d%d",&xc,&yc,&r);
 xc=xc+a/2;
 yc=b/2-yc;
 cmp(xc,yc,r);
 getch();
 closegraph();
 return 0;
 }
コード例 #30
0
ファイル: vcirc.cpp プロジェクト: mostwanteddtm/MicroSO
main()                        // test the functions
{
   // initialize the graphics system
   int graphdriver = DETECT, graphmode;
   initgraph(&graphdriver, &graphmode, "..\\bgi");

   Circle MyCircle(100, 200, 50);   // declare a circle object
   MyCircle.Show();                 // show it
   getch();                         // wait for keypress
   MyCircle.MoveTo(200, 250);       // move the circle (tests hide
                                    // and show also)
   getch();
   MyCircle.Expand(50);             // make it bigger
   getch();
   MyCircle.Contract(75);           // make it smaller
   getch();
   closegraph();
   return 0;
}