Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <graphics.h>
- #include <iostream>
- #include <limits.h>
- using namespace std;
- void MinMax(int n, double arr[], double &min, double &max){
- for(int i = 0; i < n; i++)
- if(arr[i] > max) max = arr[i];
- else if(arr[i] < min) min = arr[i];
- }
- void Points(int n, double vhx[], double vhy[], double x0, double y0, double xmin, double ymin,
- double Sx, double Sy){
- for(int i = 0; i < n; i++){
- int xp = x0 + (vhx[i] - xmin)/Sx;
- int yp = y0 - (vhy[i] - ymin)/Sy;
- circle(xp, yp, 5);
- }
- for(int i = 1; i < n; i++){
- //line(x0 + vhx[i-1], y0 - vhy[i-1], x0 + vhx[i], y0 - vhy[i]);
- }
- }
- void ax(int d, double x0, double y0, int P, int D, double min, double S){
- if(d == 0){
- int Ip = P/D;
- cout<<Ip<<endl;
- }else{
- int Jp = P/D;
- cout<<Jp<<endl;
- }
- }
- int main(){
- double x0 = 50, y0 = 600, px = 600, py = 550, dx = 40, dy = 40;
- double VhodX[8] = {10.2, 115.1, 222.8, 118.5, 333.1, 217.4, 262.9, 413.8};
- double VhodY[8] = {120.1, 321.3, 412.5, 118.3, 212.2, 134.4, 222.7, 133.2};
- double minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN;
- int n = 8;
- initwindow(800, 800, "p1");
- MinMax(n, VhodX, minX, maxX);
- MinMax(n, VhodY, minY, maxY);
- double Sx = (maxX - minX) / px;
- double Sy = (maxY - minY) / py;
- Points(n, VhodX, VhodY, x0, y0, minX, minY, Sx, Sy);
- ax(0, x0, y0, 0, 0, minX, Sx);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement