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

37 lines
783 B
C++

#include <iostream>
#include <graphics.h>
#include <cmath>
using namespace std;
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
line(100, 400, 400, 400);
line(100, 400, 100, 100);
const double k1 = 2, b1 = 1;
const double k2 = -1, b2 = 3;
const double k3 = 0.5, b3 = -2;
const double k4 = -3, b4 = -4;
for (int x = 100; x <= 400; x++) {
int y1 = k1 * (x - 100) + b1 + 400;
putpixel(x, y1, GREEN);
int y2 = k2 * (x - 100) + b2 + 400;
putpixel(x, y2, BLUE);
int y3 = k3 * (x - 100) + b3 + 400;
putpixel(x, y3, RED);
int y4 = k4 * (x - 100) + b4 + 400;
putpixel(x, y4, YELLOW);
}
getch();
closegraph();
return 0;
}