Flickr4Java icon indicating copy to clipboard operation
Flickr4Java copied to clipboard

Translate math formula to C++

Open Saidalo1 opened this issue 3 years ago • 0 comments

I need to write a formula to determine the distance between two points in a plane in C++. ### Here is the formula:

photo_2021-12-28_18-29-01

I wrote such a code for this, but where is my mistake and how should I write the code correctly?:

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    double x1, x2, y1, y2, distance;
    distance = sqrt((pow(x2-x1), 2) + pow((y2-y1), 2));
    return 0;
}

Saidalo1 avatar Dec 28 '21 13:12 Saidalo1