Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
724 B
3
Indexable
Never
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
int gd=DETECT,gm;
void main()
{
	int Shx,Shy,x1,y1,x2,y2,i,j;
	printf("Enter the co-ordinate x1 and y1:");
	scanf("%d%d",&x1,&y1);
	printf("Enter the co-ordinate x2 and y2:");
	scanf("%d%d",&x2,&y2);
	printf("Enter the shearing factor:");
	scanf("%d%d",&Shx,&Shy);
	initgraph(&gd,&gm,NULL);
	setcolor(4);
	line(x1,y1,x2,y1);
	line(x2,y1,x2,y2);
	line(x2,y2,x1,y2);
	line(x1,y2,x1,y1);
	int x11,x12,y11,y12;
	for(i=x1;i<=x2;i++)
	for(j=y1;j<=y2;j++)
	{
	x11=i+Shx*j;
	x12=i+Shx*j;
	y11=j+Shy*i;
	y12=j+Shy*i;
	setcolor(i%8);
	line(x11,y11,x12,y11);
	line(x12,y11,x12,y12);
	line(x12,y12,x11,y12);
	line(x11,y12,x11,y11);
	}
	getch();
	closegraph();
}
Leave a Comment