Skip to content

Instantly share code, notes, and snippets.

@Adals20
Created March 9, 2017 15:22
Show Gist options
  • Save Adals20/3502772904567369003a8050f0b7be59 to your computer and use it in GitHub Desktop.
Save Adals20/3502772904567369003a8050f0b7be59 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cmath>
using namespace std;
float distance(float x1,float y1,float x2,float y2){
float d = sqrt(pow((x2-x1),2)+pow((y2-y1),2));
return d;
}
main(){
float x1, x2, y1, y2, xx, yy;
cout << "Introdusca los dos cordenadas para calcular el punto medio" << endl;
cout << "X1: ";
cin >> x1;
cout << "Y1: ";
cin >> y1;
cout << "X2: ";
cin >> x2;
cout << "Y2: ";
cin >> y2;
xx = distance(x1,y1,x2,y2);
cout << "La distacia es: " << xx << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment