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

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,48 @@
#include <iostream>
#include <graphics.h>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
srand(time(0));
ofstream fileX("x.txt"), fileY("y.txt");
for (int i = 0; i < 100; i++) {
int x = rand() % 31 - 5;
int y = rand() % 31 - 5;
fileX << x << endl;
fileY << y << endl;
}
fileX.close();
fileY.close();
ifstream fileXRead("x.txt"), fileYRead("y.txt");
int x, y;
while (fileXRead >> x && fileYRead >> y) {
int graphX = x * 10 + 100;
int graphY = 400 - y * 10;
if (x + y == 35) {
circle(graphX, graphY, 5);
} else {
putpixel(graphX, graphY, WHITE);
}
}
fileXRead.close();
fileYRead.close();
getch();
closegraph();
return 0;
}