fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main() {
  5. double x1 = 1, x2 = 2, y1 = 1, y2 = 2, w;
  6. w = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
  7. cout << w;
  8. }
  9.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
1.41421