Archived
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#include <iostream>
|
|
#include <cmath>
|
|
#include <graphics.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int gd = DETECT, gm;
|
|
initgraph(&gd, &gm, "");
|
|
|
|
const int angleABD = 46;
|
|
const int angleCAD = 58;
|
|
int angleABC = 180 - angleABD - angleCAD;
|
|
|
|
setcolor(WHITE);
|
|
outtextxy(10, 10);
|
|
outtextxy(10, 30);
|
|
int x0 = 200, y0 = 200;
|
|
int radius = 100;
|
|
circle(x0, y0, radius);
|
|
|
|
int xA = x0 + radius * cos(angleCAD * M_PI / 180);
|
|
int yA = y0 - radius * sin(angleCAD * M_PI / 180);
|
|
int xB = x0 + radius * cos((angleCAD + angleABD) * M_PI / 180);
|
|
int yB = y0 - radius * sin((angleCAD + angleABD) * M_PI / 180);
|
|
int xC = x0 + radius * cos((angleCAD + angleABD + angleABC) * M_PI / 180);
|
|
int yC = y0 - radius * sin((angleCAD + angleABD + angleABC) * M_PI / 180);
|
|
int xD = x0 + radius * cos((angleCAD + angleABD + angleABC + angleCAD) * M_PI / 180);
|
|
int yD = y0 - radius * sin((angleCAD + angleABD + angleABC + angleCAD) * M_PI / 180);
|
|
putpixel(xA, yA, WHITE);
|
|
putpixel(xB, yB, WHITE);
|
|
putpixel(xC, yC, WHITE);
|
|
putpixel(xD, yD, WHITE);
|
|
|
|
line(xA, yA, xB, yB);
|
|
line(xB, yB, xC, yC);
|
|
line(xC, yC, xD, yD);
|
|
line(xD, yD, xA, yA);
|
|
|
|
char text[50];
|
|
sprintf(text, "Angle ABC = %d°", angleABC);
|
|
outtextxy(10, 50, text);
|
|
|
|
getch();
|
|
closegraph();
|
|
|
|
return 0;
|
|
}
|
|
|