下面的代码编译得很好,但我不能在 TURBO C++ 上运行它。运行时屏幕只是闪烁。但我也使用了 getch()。我不知道我哪里出错了。我应该怎么办?
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<graphics.h>
void main()
{
int gm;
int gd = DETECT; //graphic driver
int x1, x2, x3, y1, y2, y3, x1n, x2n, x3n, y1n, y2n, y3n, c; //vertices of triangle
int r; //rotation angle
float t;
initgraph(&gd, &gm, "C:\TURBOC3:\BGI:");
setcolor(RED);
printf("\t Enter vertices of triangle: ");
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);
printf("\nEnter angle of rotation: ");
scanf("%d",&r);
t = 3.14*r/180; //converting degree into radian
//applying 2D rotation equations
x1n = abs(x1*cos(t)-y1*sin(t));
y1n = abs(x1*sin(t)+y1*cos(t));
x2n = abs(x2*cos(t)-y2*sin(t));
y2n = abs(x2*sin(t)+y2*cos(t));
x3n = abs(x3*cos(t)-y3*sin(t));
y3n = abs(x3*sin(t)+y3*cos(t));
//Drawing the rotated triangle
line(x1n,y1n,x2n,y2n);
line(x2n,y2n,x3n,y3n);
line(x3n,y3n,x1n,y1n);
getch();
}