#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 void main() { int i,os_m,nPage,total,pg[25]; clrscr(); printf("\nEnter total memory size:"); scanf("%d",&total); printf("\nEnter memory for OS:"); scanf("%d",&os_m); printf("\nEnter no. of pages:"); scanf("%d",&nPage); for(i=0;i =pg[i]) { printf("\n Allocate page %d",i+1); total=total-pg[i]; } else printf("\n page %d is not allocated due to insufficient memory.",i+1); } printf("\n External Fragmentation is:%d",total); getch(); } OUTPUT Enter total memory size:1024 Enter memory for OS:256 Enter no. of pages:4 Enter size of page[1]:128 Enter size of page[2]:512 Enter size of page[3]:64 Enter size of page[4]:512 Allocate page 1 Allocate page 2 Allocate page 3 page 4 is not allocated due to insufficient memory. External Fragmentation is:64
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