Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <iomanip>
- #include <random>
- #include <ctime>
- using namespace std;
- struct Trngl
- {
- int x1;
- int y1;
- int x2;
- int y2;
- int x3;
- int y3;
- }tr[3];
- struct Part
- {
- int lx;
- int rx;
- int uy;
- int dy;
- }Prt[4];
- class CoordFlor
- {
- public:
- CoordFlor (int *arr)
- {
- mt19937 gen ((int)time(0));
- uniform_int_distribution<int> disty(0,400);
- uniform_int_distribution<int> distx(0,300);
- for (int i=0;i<3;i++)
- {
- tr[i].x1= distx(gen); tr[i].y1= disty(gen);
- tr[i].x2= distx(gen); tr[i].y2= disty(gen);
- tr[i].x3= distx(gen); tr[i].y3= disty(gen);
- }
- int crdIt= -1;
- for (int i=0;i<4;i++)
- {
- Prt[i].dy= arr[++crdIt]; Prt[i].uy= arr[++crdIt];
- Prt[i].lx= arr[++crdIt]; Prt[i].rx= arr[++crdIt];
- }
- }
- //////////////
- void PrintCoord()
- {
- cout << "Координаты плоскости по четвертям" << endl;
- for (int i=0; i<4; i++)
- {
- cout << "Четверть №" << (i+1) << " dy\\uy, lx\\rx ";
- cout << "\t" << Prt[i].dy << " , " << Prt[i].uy << " ; ";
- cout << "\t" << Prt[i].lx << " , " << Prt[i].rx << endl;
- }
- cout << endl;
- cout << "Координаты вершин треугольника"<< endl;
- for (int i=0; i<3; i++)
- {
- cout << "Треугольник №" << (i+1) << endl;
- cout << "X1= " << tr[i].x1 << " Y1= " << tr[i].y1;
- cout << "\t X2= " << tr[i].x2 << " Y2= " << tr[i].y2;
- cout << "\t X3= " << tr[i].x3 << " Y3= " << tr[i].y3;
- cout << endl;
- }
- }
- };
- int main(int argc, char **argv)
- {
- system("chcp 1251 > nul"); // Руссификация сообщений
- setlocale(LC_ALL, "Russian");
- int crd[16]= {1,150,1,200,1,150,-200,-1,-1,-150,-200,-1,-1,-150,1,200};
- CoordFlor cf(crd); cf.PrintCoord();
- system("pause"); // system("pause > nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement