Help with this code

I have to create a library with the following functions.
double dist (double x1, double y1, double x2, double y2); // Finds the distance between two points with coordinates (x1, y1) and (x2, y2), and returns the result.

- double slope (double x1, double y1, double x2, double y2); // Finds the slope of the line with end points (x1, y1) and (x2, y2), and returns the result.

- double angle (double x1, double y1, double x2, double y2); // Finds the angle (in degrees) that the line joining the two points makes with the x-axis.

And this is what I got.

#include <iostream>
using namespace std;
double dist(double x1, double y1, double x2, double y2)
{
double d;
d = sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2);
return d;
}

double slope(double x1, double y1, double x2, double y2)
{
double m;
m = ((y2 - y1) / (x2 - x1));
return m;
}
double angle(double x1, double y1, double x2, double y2)
{
double a;
a = (abs(y2 - y1) / abs(x2 - x1));
return a;
}

I was just wondering if this is correct?
Topic archived. No new replies allowed.