I have been working on this for a while now and i am getting an error in line 39 error C2664 'getCoords' : cannot convert parameter 1 from 'double' to 'double*' i am having trouble understanding why this wont work. any input will help.
Code:
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
double getCoords(double *x, double *y, double *a, double *b);
int _tmain(int argc, _TCHAR* argv[])
{
double x1, y1, x2, y2;
double distance, root;
double *x, *y, *a, *b;
cout<<"Enter the x and y values for first coordinate: ";
cin>> x1 >> y1;
cout<<"Enter the x and y values for the second coordinate: ";
cin>> x2 >> y2;
x = &x1;
y = &y1;
a = &x2;
b = &y2;
getCoords(*x,*y, *a, *b);
{
double g, f, m, n;
g = a - x;
f = b - y;
m = pow(g, 2.0);
n = pow(f, 2.0);
root = m + n;
distance = sqrt(root);
return distance;
}
cout<<"The distance between the two coordnates is "<< distance;
return 0;