Skip to content

Instantly share code, notes, and snippets.

@alonzoibarra97
Created April 5, 2016 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alonzoibarra97/8f4f49b94ab149b859741b8c88b70141 to your computer and use it in GitHub Desktop.
Save alonzoibarra97/8f4f49b94ab149b859741b8c88b70141 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cmath>
int distancia (int x2, int x1, int y1, int y2)
{
int dis, d;
dis= d = sqrt((pow((x2-x1),2))- (pow((y2-y1),2)));
return dis;
}
using namespace std;
int main ()
{
int dis,x1,x2,y1,y2;
cout<< "Give two point so I can tell you the distance between them\n";
cout<< "x1 is:\n ";
cin>> x1;
cout<< "x2 is:\n ";
cin>> x2;
cout<< "y1 is:\n ";
cin>> y1;
cout<< "y2 is:\n ";
cin>> y2;
dis= distancia(x1,x2,y1,y2);
cout<< "the distance is: "<< dis;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment