#include <iostream>
#include <cmath>
using namespace std;
double dist(int x1, int x2, int y1, int y2)
{
double r1 , r2 , d ;
r1 = sqrt((x1*x1) + (y1*y1));
r2 = sqrt((x2*x2) + (y2*y2));
d = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
cout << " Distance from first point to origin :" << r1 << endl;
cout << " Distance from second point to origin :" << r2 << endl;
cout << " Distance between the two points:" << d << endl;
return r1,r2,d;
}
int main()
{
int x1, x2, y1, y2;
cout << " Enter values for x1 x2 y1 y2\n";
cin >> x1 >> x2 >> y1 >> y2 >> "\n";
dist(x1, x2, y1, y2);
char aaaa;
cin >> aaaa;
return 0;
}
daniela.valkanova 0 Newbie Poster
daniela.valkanova 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.