int double double cm double cr double cl for 200 if numb cm Pn cr Pn c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
int i;
double m;
double cm;
double cr;
double cl;
for (i = 1; i < 200; i++)
{
m= (l + r) / 2;
if (numb == 1)
{
cm = Pn(m, n);
cr = Pn(r, n);
cl = Pn(l, n);
}
if (numb == 4)
{
cm = Hn(m, n);
cr = Hn(r, n);
cl = Hn(l, n);
}
if (numb == 5)
{
cm = Ln(m, n, alpha);
cr = Ln(r, n, alpha);
cl = Ln(l, n, alpha);
}
if ( cr > cl)
if (cm <= 0)
l = m;
else
r = m;
else
if (cm < 0)
r = m;
else
l = m;
}
return l;
}