Работы по программированию

This commit is contained in:
IgorVolochay
2026-07-28 09:56:54 +03:00
parent b85155ff95
commit 8602b7e845
73 changed files with 4090 additions and 0 deletions
@@ -0,0 +1,34 @@
#include <graphics.h>
#include <math.h>
void drawGraph() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
int x, y;
int max_x = getmaxx();
int max_y = getmaxy();
int origin_x = max_x / 2;
int origin_y = max_y / 2;
// Draw axes
line(0, origin_y, max_x, origin_y); // X-axis
line(origin_x, 0, origin_x, max_y); // Y-axis
// Plot the function
for (x = -origin_x; x <= origin_x; x++) {
float fx = (float)x / 10; // Scale x for better visibility
float fy = ((fx + 4) * (fx * fx + 3 * fx + 2)) / (fx + 1);
y = origin_y - (int)(fy * 10); // Scale y for better visibility
putpixel(origin_x + x, y, GREEN);
}
getch();
closegraph();
}
int main() {
drawGraph();
return 0;
}