Tuesday, December 26, 2017
Home »
Computer Graphics
» Program for 2D reflection in C along X-axis (using graphics.h)
Program for 2D reflection in C along X-axis (using graphics.h)
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include<math.h>
int main()
{
int gm;
int gd=DETECT;
int x1,x2,x3,y1,y2,y3;
//initgraph(&gd,&gm,"c:\tc\bg:");
initwindow(1200,600);
printf("\n\t Enter the three points of a triangle: ");
setcolor(6);
setlinestyle(0,0,3);
scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
setcolor(4);
line(x1,y1+240,x2,y2+240);
line(x2,y2+240,x3,y3+240);
line(x3,y3+240,x1,y1+240);
getch();
closegraph();
}
0 comments:
Post a Comment