#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
struct s
{ int x,y ;
};
void main()
{ int n;
int gd= DETECT ,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
struct s inp[10],out[10];
printf("\n Enter the no of
vertices");
scanf ("%d",&n);
for(int i=0;i<n;i++)
{ scanf ("%d%d",&inp[i].x,&inp[i].y);
}
int sx,sy;
printf("\n Enter the scaling value");
scanf ("%d%d",&sx,&sy);
for(i=0;i<n;i++)
{ out[i].x= inp[i].x * sx;
out[i].y = inp[i].y * sy;
}
inp[n]= inp[0];
out[n] = out[0];
for(i=0;i<n;i++)
{ setcolor(7);
line(inp[i].x,inp[i].y,inp[i+1].x,inp[i+1].y);
}
getch();
for(i=0;i<n;i++)
{
printf ("%d%d",out[i].x,out[i].y);
}
getch();
for(i=0;i<n;i++)
{
setcolor(5);
line(out[i].x,out[i].y,out[i+1].x,out[i+1].y);
}
getch();
closegraph();
}
No comments:
Post a Comment