Line | |
---|
1 | subroutine search(y,x,n,i,mf) |
---|
2 | c searches an ordered increasing table, x, of n elements, to |
---|
3 | c find y. if y is found, mf is set to zero and i is set such |
---|
4 | c that y = x(i). otherwise, i is returned such that y is |
---|
5 | c between x(i) and x(i+1). |
---|
6 | c----------------------------------------------------------------------- |
---|
7 | c |
---|
8 | include 'ucom.h' |
---|
9 | dimension x(n) |
---|
10 | c----------------------------------------------------------------------- |
---|
11 | c* |
---|
12 | mf=1 |
---|
13 | if(n)1,1,2 |
---|
14 | 1 continue |
---|
15 | i=0 |
---|
16 | go to 15 |
---|
17 | 2 continue |
---|
18 | do 3 k=2,n |
---|
19 | j=k |
---|
20 | if(y.lt.x(k))go to 4 |
---|
21 | 3 continue |
---|
22 | if(y.eq.x(n))mf=0 |
---|
23 | i=n |
---|
24 | go to 15 |
---|
25 | 4 continue |
---|
26 | i=j-1 |
---|
27 | if(y.eq.x(i))mf=0 |
---|
28 | 15 continue |
---|
29 | return |
---|
30 | end |
---|
31 | c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* |
---|
Note: See
TracBrowser
for help on using the repository browser.