#include
#include
#include
#include
int x1,y1,x2,y2,x,y,x3,y3,x4,y4,ch;
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
clrscr();
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
do
{
cout<<" #############MAIN-MENU###############\n";
cout<<" SHEARING\n";
cout<<" 1.LINE\n";
cout<<" 2.RECTANGLE\n";
cout<<" 3.TRIANGLE\n";
cout<<"enter your choice:0 for exit:\n";
cin>>ch;
switch(ch)
{
case 1: cout<<"enter the values of line coordinates:";
cin>>x1>>y1>>x2>>y2;
cout<<"enter the value of shearing for xaxis:";
cin>>x;
cout<<"enter the value of shearing for y-axis:";
cin>>y;
cleardevice();
line(x1,y1,x2,y2);
cout<<"now hit a key to see shear in x_axis:";
getch();
line(x1,y1,x2*x,y2);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
line(x1,y1,x2,y2*y);
break;
case 2: cout<<"enter the top left coordinates:";
cin>>x1>>y1;
cout<<"enter the bottom right coordinates:";
cin>>x2>>y2;
cout<<"enter the values of shearing coordinate for x_shear:\n";
cin>>x;
cout<<"enter the values of shearing coordinate for y_shear:\n";
cin>>y;
cleardevice();
rectangle(x1,y1,x2,y2);
cout<<"now hit a key to see shear in x_axis:";
getch();
rectangle(x1,y1,x2*x,y2);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
rectangle(x1,y1,x2,y2*y);
break;
case 3: cout<<"enter coordinates of line1:\n";
cin>>x1>>y1>>x2>>y2;
cout<<"enter coordinates for relative line:\n";
cin>>x3>>y3;
cout<<"enter shear coordinate for x_shear:\n";cin>>x;
cout<<"enter shear coordinate for y_shear:\n";cin>>x;
cleardevice();
line(x1,y1,x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
cout<<"\nnow hit a key to see shear in x_axis:";
getch();
moveto(x1,y1);
lineto(x2*x,y2);
moveto(x2*x,y2);
lineto(x3*x,y3);
moveto(x3*x,y3);
lineto(x1,y1);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
moveto(x1,y1);
lineto(x2,y2*y);
moveto(x2,y2*y);
lineto(x3,y3*y);
moveto(x3,y3*y);
lineto(x1,y1);
break;
case 0: break;
default:cout<<"invalid choice";break;
}}while(ch!=0);
getch();
closegraph();
}
0 comments:
Post a Comment