try it this way
Code:
#include <iostream>
#include <cmath>
using namespace std;
float getcoords(int x1, int y1, int a1, int b1);
int main()
{
int x,y,a,b,distance;
cout<<"Enter the x and y values for first coordinate: ";
cin>> x >> y;
cout<<"Enter the x and y values for the second coordinate: ";
cin>> a >> b;
cout<<"The distance between the two coordnates is "<< getcoords(x,y,a,b)<<endl;
system("PAUSE");
return 0;
}
float getcoords(int x1, int y1, int a1, int b1)
{
return sqrt(((a1-x1)*(a1-x1))+((b1-y1)*(b1-y1)));
}
that shud work...