This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

39 lines
893 B
C++

#include <graphics.h>
#include <iostream>
#include <fstream>
void drawTriangle(float A[], float B[], float C[]) {
line(A[0], A[1], B[0], B[1]);
line(B[0], B[1], C[0], C[1]);
line(C[0], C[1], A[0], A[1]);
}
float calculateArea(float base, float height) {
return 0.5 * base * height;
}
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
// Условия задачи
float A[] = {100, 100}, B[] = {200, 300}, C[] = {300, 100};
drawTriangle(A, B, C);
// Параметры
float AC = 16, MN = 10, areaABC = 32;
// Площадь треугольника MBN
float areaMBN = (MN / AC) * areaABC;
outtextxy(10, 10, "Area of triangle MBN:");
char buffer[50];
sprintf(buffer, "%.2f", areaMBN);
outtextxy(10, 30, buffer);
getch();
closegraph();
return 0;
}