To perform mirroring on a point

//To perform mirroring on a point

#include<iostream.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int x,y,r,y1;
char ab;
cout<<“\n\t\t\t\*Mirroring of a point*\n”;
cout<<“enter the x and y coordinates:-\n”;
cin>>x>>y;
cout<<“\n*press 1 for mirror reflecting about y-axis*\n”;
cout<<“\n*press 2 for mirror reflecting about x-axis*\n”;
cout<<“\n*press 3 for mirror reflecting about both the axis*\n”;
cin>>ab;
int gd=DETECT,gm;
initgraph(&gd,&gm,””);
setbkcolor(WHITE);
switch(ab)
{
case ‘1’:
{
putpixel(x,y,8);
y=480-y;
putpixel(x,y,8);
break;
}
case ‘2’:
{
putpixel(x,y,8);
x=600-x;
putpixel(x,y,8);
break;
}
case ‘3’:
{
putpixel(x,y,8);
y1=480-y;
putpixel(x,y1,8);
x=600-x;
putpixel(x,y,8);
break;
}
default:
cout<<“Please enter valid choice”;
}
setcolor(8);
outtextxy(115,70,”Mirroring effect on point”);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *