The correct answer for the value of x1=7, x2=3, y1=12, y2=9 is supposed to be 5. This code is giving me 5.9... I can't figure out what the problem is.
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
int x1, x2, y1, y2;
double distance;
distance = sqrt(pow((x2-x1), 2) + pow((y2-y1), 2));
cout << "Enter x1: ";
cin >> x1;
cout << "Enter x2: ";
cin >> x2;
cout << "Enter y1: ";
cin >> y1;
cout << "Enter y2: ";
cin >> y2;
cout << "The distance between two points is: " << distance << endl;
return 0;
}