answersLogoWhite

0

//write a program to scale a rectangle at given point(h,k) #include<graphics.h> #include<stdio.h> #include<conio.h> #include<math.h> int round(float); void main() { int driver,mode,x1,y1,x2,y2,x3,y3,x4,y4,theeta,h,k,a,b; float x_dash1,y_dash1,x_dash2,y_dash2,x_dash3,y_dash3,x_dash4,y_dash4; char str[10]; clrscr(); printf("ENTER THE UPPER LEFT CORNER OF THE RECTANGLE : (X1,Y1)"); scanf("%d%d",&x1,&y1); printf("ENTER THE UPPER RIGHT CORNER OF THE RECTANGLE : (X2,Y2)"); scanf("%d%d",&x2,&y2); printf("ENTER THE LOWER RIGHT CORNER OF THE RECTANGLE : (X3,Y3)"); scanf("%d%d",&x3,&y3); printf("ENTER THE LOWER LEFT CORNER OF THE RECTANGLE : (X4,Y4)"); scanf("%d%d",&x4,&y4); driver=DETECT; initgraph(&driver,&mode,"c:\\tc\\bgi"); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x4,y4); line(x4,y4,x1,y1); sprintf(str,"(%d,%d)",x1,y1); outtextxy(x1-75,y1-10,str); sprintf(str,"(%d,%d)",x2,y2); outtextxy(x2+10,y2-10,str); sprintf(str,"(%d,%d)",x3,y3); outtextxy(x3+10,y3+10,str); sprintf(str,"(%d,%d)",x4,y4); outtextxy(x4-75,y4+10,str); getch(); closegraph(); printf("ENTER POINTS OF SCALING \n"); printf("ENTER POINTS FOR X-AXIS :"); scanf("%d",&h); printf("ENTER POINTS FOR Y-AXIS : "); scanf("%d",&k); printf("ENTER SIZE OF SCALING(i.e '2' for twice and '3' for thrice)\n"); printf("ENTER THE VALUE TO BE SCALED FOR x-axis : "); scanf("%d",&a); printf("ENTER THE VALUE TO BE SCALED FOR y-axis : "); scanf("%d",&b); if(a<4 & b<4) { x_dash1=x1*a-h*a+h; y_dash1=y1*b-k*b+k; x_dash2=x2*a-h*a+h; y_dash2=y2*b-k*b+k; x_dash3=x3*a-h*a+h; y_dash3=y3*b-k*b+k; x_dash4=x4*a-h*a+h; y_dash4=y4*b-k*b+k; initgraph(&driver,&mode,"c:\\tc\\bgi"); cleardevice(); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x4,y4); line(x4,y4,x1,y1); setcolor(GREEN); line(x_dash1,y_dash1,x_dash2,y_dash2); line(x_dash2,y_dash2,x_dash3,y_dash3); line(x_dash3,y_dash3,x_dash4,y_dash4); line(x_dash4,y_dash4,x_dash1,y_dash1); sprintf(str,"(%d,%d)",round(x_dash1),round(y_dash1)); outtextxy(round(x_dash1),round(y_dash1),str); sprintf(str,"(%d,%d)",round(x_dash2),round(y_dash2)); outtextxy(round(x_dash2),round(y_dash2),str); sprintf(str,"(%d,%d)",round(x_dash3),round(y_dash3)); outtextxy(round(x_dash3),round(y_dash3),str); sprintf(str,"(%d,%d)",round(x_dash4),round(y_dash4)); outtextxy(round(x_dash4),round(y_dash4),str); getch(); closegraph(); } else printf("YOU HAVE ENTERED WRONG SCALLING VALUES"); getch(); } int round(float x) { int x1=x; float x2=x-x1; if(x2>0.5) x1++; return x1; }

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Write a program to implement prim's algorithm?

dfgbrgffee


Write A program to implement insertion using AVL trees?

yes


Write a program to implement domain and referential integrity?

give me the program which can related on domain and referential integrity.


Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.


Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


Write a program to implement a line using slope intercept formula?

lund lelo mooh mein


Write a C program to implement excelp system call?

You are not able to do that, but you can write a program, that uses the system-call./* exectest.c */#include int main (void){execlp ("/bin/ls", "ls", "-ld", ".", NULL);return 0;}


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


Write a program in C language to implement the apriori algorithm?

JavaScript is one program that has been written in C to implement the Apriori algorithm. There are also several other known programs available on the Internet that implement it as well.


Write a routine to implement the t e x t function?

There are many ways you could write a routine to implement text functions. You could, for example, come up with codes.


How do you write transformation notation?

The answer will depend on the nature of the transformation.The answer will depend on the nature of the transformation.The answer will depend on the nature of the transformation.The answer will depend on the nature of the transformation.