I am suppose to find the radius using the formula for the distance of two points.
the formula is sqrt(x2-x1)^2 + (y2-y1)^2
the function accepts 4 float numbers and returns 1 float number.
This is the code I have written so far, but it wont execute correctly. It only asks for the input and doesn't execute the function.
#include<iostream>
#include<cmath>
using namespace std;
//the function prototype goes here
int radius(float, float, float, float);
int main()
{
float x1, y1, x2, y2;
float r;
cout << "Enter 4 numbers corresponding to the" << endl;
cout << "coordinates of two points : ";
cin >> x1 >> y1 >> x2 >> y2;
you need a cin.ignore();to remove the newline character left in the input stream after r = radius(x1, y1, x2, y2);
btw, your radius() function is a bit confusing, the co-ordinates of each point is non-contiguous. rather it'd be more realistic to declare struct Point with data-members x-cord, y-cord etc and a distance function for the Euclidean distance b/w 2 Point objects