Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <graphics.h>
- #include <iostream>
- using namespace std;
- int main(){
- float x[] = {-26.8, 12.2, 71.9, -34.6, 18.5, -19.4, 57.5, 43.2, 13.7};
- float y[] = {32.7, -52.7, 23.6, 15.1, 68.4, 43.6, -22.5, 33.7, 30.8};
- int n=sizeof(x)/sizeof(x[0]);
- int x0=100;
- int y0=400;
- float Px=500, Py=500;
- float xmin=x[0], xmax=x[0],ymin=y[0],ymax=y[0];
- for(int i=0;i<n;i++){
- if(x[i]<xmin){
- xmin=x[i];
- }
- if(x[i]<xmax){
- xmax=x[i];
- }
- if(y[i]<ymin){
- ymin=y[i];
- }
- if(y[i]<ymax){
- ymax=y[i];
- }
- }
- float sx = (xmax-xmin)/Px;
- float sy = (ymax-ymin)/Py;
- initwindow(800,800);
- setfillstyle(1, RED);
- int xpr,ypr;
- for(int i=0; i<n; i++){
- xpr=x0 +(x[i]-xmin)/sx;
- ypr=y0 +(y[i]-ymin)/sy;
- circle(xpr,ypr,6);
- }
- //getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement