#include< stdio.h>
#include< graphics.h>
#include< conio.h>
void BRESENHAM_CIRCLE(int x,int y,int r);
void circlePlot(int,int,int,int);
void main()
{
int x,y,r,gdriver=DETECT,gmode;
clrscr();
initgraph(&gdriver,&gmode,"");
printf("\nEnter point(x,y):");
scanf("%d %d",&x,&y);
printf("\nEnter radius:");
scanf("%d",&r);
BRESENHAM_CIRCLE(x,y,r);
getch();
}
void BRESENHAM_CIRCLE(int xCen,int yCen,int r)
{
int x=0;
int y=r;
int s=3-2*r;
circlePlot(xCen,yCen,x,y);
while(x < y)
{
x++;
if(s < 0)
s+=4*x+6;
else
{
y--;
s+=4*(x-y)+10;
}
circlePlot(xCen,yCen,x,y);
}
}
void circlePlot(int xCen,int yCen,int x,int y)
{
putpixel(xCen+x,yCen+y,WHITE);
putpixel(xCen-x,yCen+y,WHITE);
putpixel(xCen+x,yCen-y,WHITE);
putpixel(xCen-x,yCen-y,WHITE);
putpixel(xCen+y,yCen+x,WHITE);
putpixel(xCen-y,yCen+x,WHITE);
putpixel(xCen+y,yCen-x,WHITE);
putpixel(xCen-y,yCen-x,WHITE);
}
#include #include int fsize; int frm[15]; void display(); void main() { int pg[100],nPage,i,j,pf=0,top=-1,temp,flag=0; clrscr(); printf("\n Enter frame size:"); scanf("%d",&fsize); printf("\n Enter number of pages:"); scanf("%d",&nPage); for(i=0;i OUTPUT Enter frame size:3 Enter number of pages:12 Enter page[1]:1 Enter page[2]:2 Enter page[3]:3 Enter page[4]:4 Enter page[5]:1 Enter page[6]:2 Enter page[7]:5 Enter page[8]:1 Enter page[9]:2 Enter page[10]:3 Enter page[11]:4 Enter page[12]:5 page | Frame content -------------------------------------- 1 | 1 -1 -1 2 | 1 2 -1 3 | 1 2 3 4 | 4 2 3 1 | 4 1 3 2 | 4 1 2 5 | 5 1 2 1 | 5 1 2 2 | 5 1 2 3 | 5 3 2 4 | 5 3 4 5 | 5 3 4 ---------------------------...

UmetcusVatshi Juan Reyes https://wakelet.com/wake/MFQz6LvQINy9ERSmyVJst
ReplyDeletesoundzeppomur
guignosgramku Scott Jones Autodesk Maya
ReplyDeleteThe Bat!
Tor browser
warenzasi