Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Exercise 6.42 - by Anthony Jett
- // Distance Between Points
- #include <iostream>
- #include <cmath>
- using namespace std;
- double axisDst(double n1, double n2) {
- return fabs(n2 - n1);
- }
- double distance(double x1, double y1, double x2, double y2) {
- return sqrt((pow(axisDst(x1, x2), 2)) + (pow(axisDst(y1, y2), 2)));
- }
- int main()
- {
- cout << distance(0,0,3,4) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement