CG
CG
#include
#include
#include
<graphics.h>
<stdlib.h>
<stdio.h>
<conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
line(0,120,640,120);
line(100,120,100,420);
line(100,420,50,300);
line(50,300,100,300);
line(200,120,200,460);
line(250,120,250,460);
line(250,120,50,40);
line(250,120,80,20);
line(50,40,45,60);
line(45,60,60,67);
line(60,67,70,50);
line(80,20,75,40);
line(75,40,90,47);
line(90,47,100,30);
ellipse(350,200,270,90,40,80);
line(350,280,400,460);
line(600,120,600,460);
ellipse(530,250,45,315,100,80);
/* clean up */
getch();
closegraph();
return 0;
}