Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- class Distance
- {
- int x1, y1, x2, y2;
- public:
- void get()
- {
- cin >> x1 >> y1 >> x2 >> y2;
- }
- void calc()
- {
- int coordination;
- double distance;
- coordination = (pow(x2 - x1, 2) + pow(y2 - y1, 2));
- distance = sqrt(coordination);
- cout.setf(ios::fixed);
- cout.precision(3);
- cout << distance << endl;
- }
- };
- int main()
- {
- Distance output;
- output.get();
- output.calc();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment