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
college-work/Задания по C и C++/с (2024)/С(2024)/17.cpp
T

49 lines
949 B
C++

#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;
}