Archived
49 lines
949 B
C++
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;
|
|
}
|
|
|