# include "graphics.h"
main( )
{
int i, j, x1, y1, r, p, a ;
int gd = DETECT, gm, x, y ;
printf ( "Enter coordinates of center and radius of circle" ) ;
scanf ( "%d %d %d", &x, &y, &r ) ;
initgraph ( &gd, &gm, "c:\\tc\\bgi" ) ;
x1 = 0.0 ;
y1 = r ;
p = 3 - 2 * r ;
while ( x1 < y1 )
{
plotcircle ( x, y, x1, y1 ) ;
if ( p < 0 )
p = p + 4 * x1 + 6 ;
else
{
p = p + 4 * ( x1 - y1 ) + 10 ;
y1 = y1 - 1 ;
}
x1 = x1 + 1 ;
}
if ( x1 == y1 )
plotcircle ( x, y, x1, y1 ) ;
getch( ) ;
closegraph( ) ;
restorecrtmode( ) ;
}
plotcircle ( int x, int y, int x1, int y1 )
{
putpixel ( x + x1, y + y1, 15 ) ;
putpixel ( x - x1, y + y1, 15 ) ;
putpixel ( x + x1, y - y1, 15 ) ;
putpixel ( x - x1, y - y1, 15 ) ;
putpixel ( x + y1, y + x1, 15 ) ;
putpixel ( x - y1, y + x1, 15 ) ;
putpixel ( x + y1, y - x1, 15 ) ;
putpixel ( x - y1, y - x1, 15 ) ;
}
THİS İS CODE WHY DONT İT RUN?
Mod Edit:
When posting code please use code tags like below.
Also, do NOT name your topic "HELP ME". We KNOW you need help...it's WHY you came HERE and POSTED!!!
This post has been edited by JackOfAllTrades: 28 December 2010 - 03:05 PM

New Topic/Question
Reply




MultiQuote








|