© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

C Program To Draw Ellipse in Various Shapes

#include #include #include #include int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int xasp, yasp, midx, midy; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, "..//bgi"); /* 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; setcolor(getmaxcolor()); /* get current aspect ratio settings */ getaspectratio(&xasp, &yasp); /* draw normal circle */ circle(midx, midy, 200); getch(); /* clear the screen */ cleardevice(); /* adjust the aspect for a wide circle */ setaspectratio(xasp/2, yasp); circle(midx, midy, 200); getch(); /* adjust the aspect for a narrow circle */ cleardevice(); setaspectratio(xasp, yasp/2); circle(midx, midy, 200); /* clean up */ getch(); closegraph(); return 0; }

 
SLogix Student Projects
bottom