Created
February 16, 2016 02:41
-
-
Save batmantec/03e91eda0605eef62746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
float h (float x1, float x2, float y1, float y2){ | |
float a, b, ans; | |
a=x2-x1; | |
b=y2-y1; | |
ans=sqrt((pow(2.0,a))+(pow(2.0,b))); | |
return ans; | |
} | |
int main (){ | |
float x1, x2, y1, y2, a, b, ans; | |
cout << "This program calculates the distance between to points"<<endl; | |
cout << "Please give me x1: "; | |
cin >> x1; | |
cout << "Please give me x2: "; | |
cin >> x2; | |
cout << "Please give me y1: "; | |
cin >> y1; | |
cout << "Please give me y2: "; | |
cin >> y2; | |
ans=h(x1,x2,y1,y2); | |
cout << "The answare is: "<<ans; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment