tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
38
Task/Range-extraction/OxygenBasic/range-extraction.oxy
Normal file
38
Task/Range-extraction/OxygenBasic/range-extraction.oxy
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
dim sys ints(100)
|
||||
ints=>
|
||||
0, 1, 2, 4, 6, 7, 8, 11, 12, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 27, 28, 29, 30, 31, 32, 33, 35, 36,
|
||||
37, 38, 39
|
||||
|
||||
function ShowRange(sys*i) as string
|
||||
'==================================
|
||||
pr=""
|
||||
n=0
|
||||
e=0
|
||||
j=0
|
||||
k=-1
|
||||
do
|
||||
j++
|
||||
n=i(j)
|
||||
e=i(j+1)
|
||||
if e<j then
|
||||
exit do
|
||||
end if
|
||||
if e=n+1 and i(j+2)=n+2 then 'LOOKAHEAD
|
||||
if k=-1 then k=n
|
||||
else
|
||||
if k>=0 then
|
||||
pr+=k "-" i(j+1) ", " 'RANGE OF VALUES
|
||||
j++
|
||||
k=-1
|
||||
else
|
||||
pr+=n ", " 'SINGLE VALUES
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
return left pr, len(pr)-2
|
||||
end function
|
||||
|
||||
|
||||
print ShowRange ints
|
||||
Loading…
Add table
Add a link
Reference in a new issue