My code doesn't seem to compile. I receive an error saying:
cannot convert 'Point**' to 'Point*' for argument '1'
This error occurs on both lines of the function call. How may I fix this?
I just recently changed my code from passing by reference to strictly pointers.
// This program computes the distance between two points
// and the slope of the line passing through these two points.
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
struct Point
{
    double x;
    double y;
};
double dist(Point *p1, Point *p2);
double slope(Point *p1, Point *p2);
int main()
{
    Point *p1, *p2;
    char flag = 'y';
    cout << fixed << setprecision(2);
    while(flag == 'y' || flag == 'Y')
    {
        cout << "First x value: "; cin >> p1->x;
        cout << "First y value: "; cin >> p1->y;
        cout << "Second x value: "; cin >> p2->x;
        cout << "Second y value: "; cin >> p2->y; cout << endl;
        cout << "The distance between points (" << p1->x << ", " << p1->y << ") and (";
        cout << p2->x << ", " << p2->y << ") is " << dist(&p1, &p2);
        if ((p2->x - p1->x) == 0)
        { cout << " but there is no slope." << endl; cout << "(Line is vertical)" << endl; }
        else
        { cout << " and the slope is " << slope(&p1, &p2) << "." << endl; }
        cout << endl;
        cout << "Do you want to continue with another set of points?: "; cin>> flag;
        cout << endl;
    }
    return 0;
}
double dist(Point *p1, Point *p2)
{
    return sqrt((pow((p2->x - p1->x), 2) + pow((p2->y - p1->y), 2)));
}
double slope(Point *p1, Point *p2)
{
    return (p2->y - p1->y) / (p2->x - p1->x);
}
 
     
     
    