#include #include #include #include main() { int gd=DETECT; int gm=DETECT; int p,i,j,k,l,m,n,w[4],a[20],b[20],c[20],d[20],x[20],y[20]; char ch; float s,t; detectgraph(&gm,&gd); initgraph(&gm,&gd,"c:\\turboc\\bgi"); clrscr(); cleardevice(); printf("\nEnter the points of window: "); printf("\nLEFT X, LEFT TOP, RIGHT X, RIGHT BOTTOM "); scanf("%d%d%d%d",&w[0],&w[1],&w[2],&w[3]); printf("\nEnter the number of sides of polygon: "); scanf("%d",&n); printf("\nEnter the points: "); for(i=0;iw[2])) goto p; if((y[i]==y[p])&&(y[i]w[3])) goto p; if(x[i]<=w[0]&&x[p]<=w[0]) goto p; if(y[i]<=w[1]&&y[p]<=w[1]) goto p; if(x[i]>=w[2]&&x[p]>=w[2]) goto p; if(y[i]>=w[3]&&y[p]>=w[3]) goto p; s=(y[p]-y[i]+1); s=s/(x[p]-x[i]+1); if(x[i]1) { t=s*(w[0]-x[i])+y[i]; a[j]=w[0]; b[j]=t; } if(x[i]w[2]&&y[i]w[2]) { t=s*(w[2]-x[i])+y[i]; a[j]=w[2]; b[j]=t; } if(y[i]>w[3]) { t=(1/s)*(w[3]-y[i])+x[i]; a[j]=t; b[j]=w[3]; } if(x[i]>w[0]&&x[i]w[1]&&y[i]1) { t=s*(w[0]-x[p])+y[p]; c[j]=w[0]; d[j]=t; } if(x[p]w[2]&&y[p]w[2]) { t=s*(w[2]-x[p])+y[p]; c[j]=w[2]; d[j]=t; } if(y[p]w[3]) { t=(1/s)*(w[3]-y[p])+x[p]; c[j]=t; d[j]=w[3]; } if(x[p]>w[0]&&x[p]w[1]&&y[p]