Program to perform mirror reflection on a circle

/* Program to perform mirror reflection on a circle */

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

Leave a Reply

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