Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Exercise_642

a guest Mar 13th, 2018 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. // Exercise 6.42 - by Anthony Jett
  2. // Distance Between Points
  3.  
  4. #include <iostream>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8.  
  9. double axisDst(double n1, double n2) {
  10.     return fabs(n2 - n1);
  11. }
  12.  
  13. double distance(double x1, double y1, double x2, double y2) {
  14.     return sqrt((pow(axisDst(x1, x2), 2)) + (pow(axisDst(y1, y2), 2)));
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20.     cout << distance(0,0,3,4) << endl;
  21.     return 0;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top