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