Archived
Работы по программированию
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user