Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float distance(float x1, float y1, float x2, float y2)
- {
- return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
- }
- int main()
- {
- float a, b, x, y;
- cout << "Enter the first point" << endl;
- cin >> a >> b;
- cout << "Enter the second point" << endl;
- cin >> x >> y;
- float result = distance(a,b,x,y);
- cout << "The distance between those two points is " << result << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement