fork download
  1.  
  2. #include<iostream>
  3. #include<cmath>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. float x1,y1,x2,y2;
  9. cout<<"Enter x1 and y1 :";
  10. cin>>x1>>y1;
  11. cout<<"Enter x2 and y2 :";
  12. cin>>x2>>y2;
  13.  
  14. float distance=pow((pow(x2-x1,2))+pow(y2-y1,2),0.5);
  15.  
  16. cout<<"The distance between the two points is :"<<distance;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5380KB
stdin
1 9 
3 -5
stdout
Enter x1 and y1 :Enter x2 and y2 :The distance between the two points is :14.1421