fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. struct point {
  6. int x, y;
  7. double length() {
  8. return sqrt(pow(x, 2)+pow(y, 2));
  9. }
  10. };
  11.  
  12. int main() {
  13. point input;
  14. while(cin >> input.x >> input.y) {
  15. cout << input.length() << endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 3472KB
stdin
5 0
10 0
2 2
5 0
32 12
42 52
stdout
5
10
2.82843
5
34.176
66.8431