### Evaluating the precision of the difference of 2 numbers

As you will understand I am an absolute beginner and therefore your help is really appreciated. The problem asks to write a program that contains a function f(double x, double y, double precision) that returns 1 if the absolute value of the difference x-y is less than the precision. The program should repeat the process 3 times of reading x,y and precision and indicating whether the numbers are equal up to the indicated precision.

i.e the output should look something like:
Input x=2.1
Input y=2.1
input precision 1E-05
The numbers are equal to that precision

and do that 3 times, giving inputs on 3 different occasions

What I got so far is:

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344`` ``````// Prorgamm for Assignment 2a.cpp // Returns 1 if the absolute value of the difference of two variables x, y is lees than the precision specified. #include #include using namespace std; // Define the function IsEqual double IsEqual(double x, double y, double precision) { double r; r=abs(x - y); return r; } int main() { //Input x,y, precision double x, y, precision; cout <<"Give me X: "; cin >> x; cout <<"Give me Y: "; cin >> y; cout <<"Give me a precision:"; cin>> precision; //Define local r // Set conditions for which number are equal at the indicated precision double r; if(r=precision){ //OR should it be if(r==precision) cout<<"The numbers are equal at this precision"; }else{ cout<<"The numbers are not equal at tha precision"; } return 0; }``````

Does this work? When i run the program and after setting the values of x,y, precision I get A message and then output screnn closes shortly after (cant really see the answer and test if the above works)

How do i get to run the program three times, each time giving different values for x, y precision?