#include< stdio.h> #include< graphics.h> #include< conio.h> #define ROUND(a) ((int)(a+0.5)) void ellipseMidPoint(int xCen,int yCen,int Rx,int Ry); void ellipsePlot(int,int,int,int); void main() { int x,y,rx,ry,gdriver=DETECT,gmode; clrscr(); initgraph(&gdriver,&gmode,""); setbkcolor(YELLOW); printf("\nEnter point(x,y):"); scanf("%d %d",&x,&y); printf("\nEnter radius(rx,ry):"); scanf("%d %d",&rx,&ry); ellipseMidPoint(x,y,rx,ry); getch(); } void ellipseMidPoint(int xCen,int yCen,int Rx,int Ry) { int Rx2=Rx*Rx; int Ry2=Ry*Ry; int twoRx2=2*Rx2; int twoRy2=2*Ry2; int x=0; int y=Ry; int px=0; int py=twoRx2*y; float p; ellipsePlot(xCen,yCen,x,y); p=Ry2-(Rx2*Ry)+ROUND(0.25*Rx2); while(px < py) { x++; px+=twoRy2; if(p < 0) p+=Ry2+px; else { y--; py-=twoRx2; p+=Ry2+px-py; } ellipsePlot(xCen,yCen,x,y); } p=Ry2*ROUND(x+0.5)*ROUND(x+0.5)+Rx2*(y-1)*(y-1)-Rx2*Ry2; while(y > 0) { y--; py-=twoRx2; if(p > 0) p+=Rx2-py; else { x++; px+=twoRy2; p+=Rx2-py+px; } ellipsePlot(xCen,yCen,x,y); } } void ellipsePlot(int xCen,int yCen,int x,int y) { putpixel(xCen+x,yCen+y,BLUE); putpixel(xCen-x,yCen+y,BLUE); putpixel(xCen+x,yCen-y,BLUE); putpixel(xCen-x,yCen-y,BLUE); }
#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 ---------------------------...
YscinomKconsta-North Las Vegas Mickael Hamby https://wakelet.com/wake/3aSjYU3J3LUM7u0FlIArt
ReplyDeleteofafusar
0credocPcal-ki_Sioux Falls Melinda Khan NetBalancer
ReplyDeleteESET NOD32 Smart Security
Winamp Pro
pecttunavi