1. ## looping help

Code:
```#include <iostream>
using namespace std;
void check(double a, double b);
void checkepsilon(double eps);
computexmid(double& c, double& d, double eps, double& mid);
int main()

{
double xleft = 0;
double xright = 0;
double epsilon = 0;
double mp = 0;
double xmid = 0;
cout << "Please enter xleft " << endl;
cin >> xleft;
cout << "Please enter xright" << endl;
cin >> xright;
check(xleft, xright);
cout << "Please enter epsilon" << endl;
cin >> epsilon;
checkepsilon(epsilon);
xmid = computexmid(xleft, xright, epsilon, mp);

return 0;
}

void check(double a, double b)
{

if(a > b)
cout << "Bisection can not be computed (sign error, or xleft is greater than xright)" << endl;
}

void checkepsilon(double ep)
{
double eps = 0;
if(eps < 0)
cout << "Error - epsilon must be a positive number" << endl;
}

computexmid(double& c, double& d, double eps, double& mid)
{

do{mid = (0.5 * (c+d));}
while(( d-c) > eps);
{
if( (d-c) <= eps)
cout << "x left is " << c << ", x right is " << d << endl;
}

return mid;
}```
ok my question is how do i stop computexmid to stop going into infinite loop and return xmid and xleft and xright for me?
incase you're wondering im trying to do besection for my programming homework.
if you need to see clearer pics of what im trying to do, check out this out my assignment.

2. I'm not familiar with what you are trying to do and the link is giving me an error page, but I can see a problem:
Code:
```do{mid = (0.5 * (c+d));}
while(( d-c) > eps);```
d and c are not changing there, which is why you run into an infinite loop. So basically you need to either change the condition of the loop or change the values of c and d in the loop.

Also, you should declare a return type for your function (probably double in this case). Right now it probably defaults to int (if it even compiles)

Maybe you should explain the assignment or at least review do...while loops, because it doesn't look like you quite understand it.