Post by debluzz on Mar 20, 2022 11:09:34 GMT -5
need some help on sorting if there are pairs in the sort.
The problem is it does not pick the pairs up. ( run sort-see line 5 & 6)
It is set up to give 3-lowest . But if any are duplicates. It goes to the next lowest---not good
data
1 24 10 30 33
2 13 4 1.5 18
3 22 22 12 30
4 23 26 15 32
5 18 6 3 22
6 18 14 4 24
'========================
for i= 1 to 1
'dim an 8x8 array to hold the row and column data
col=5
row=8
'give the array index values a name
bx=1
total=2
strfn=3
score=4
maintotal=5
'now dim a numeric array since all your data is numeric
'lose the # character before the box number it spoils the numeric data
dim r(row,col)
open "finish1.txt" for input as #f
for r=1 to row
'get the first line from finish1.txt
line input #f,l$
for c=1 to col
'break that line into columns
'note that it is fetched as a string
'but converted to plain old numeric with val()
r(r,c)=val(word$(l$,c))
next
next
close #f
'print the array as loaded
print "______________The array as loaded________________"
gosub
The problem is it does not pick the pairs up. ( run sort-see line 5 & 6)
It is set up to give 3-lowest . But if any are duplicates. It goes to the next lowest---not good
data
1 24 10 30 33
2 13 4 1.5 18
3 22 22 12 30
4 23 26 15 32
5 18 6 3 22
6 18 14 4 24
'========================
for i= 1 to 1
'dim an 8x8 array to hold the row and column data
col=5
row=8
'give the array index values a name
bx=1
total=2
strfn=3
score=4
maintotal=5
'now dim a numeric array since all your data is numeric
'lose the # character before the box number it spoils the numeric data
dim r(row,col)
open "finish1.txt" for input as #f
for r=1 to row
'get the first line from finish1.txt
line input #f,l$
for c=1 to col
'break that line into columns
'note that it is fetched as a string
'but converted to plain old numeric with val()
r(r,c)=val(word$(l$,c))
next
next
close #f
'print the array as loaded
print "______________The array as loaded________________"
gosub
gosub [listit]
'desending order needed
'SORT arrayName(), start, end, [column]
'So to sort rows 1 to 8 on gradeavg
print "_______________The array as loaded_______________"
CLS
sort r(),1,6,total
print " "
print " >>total<<"
gosub [listit]
sort r(),1,6,strfn
print " "
print " >>strfn<< "
gosub
sort r(),1,6,score
print " "
print " >>score<<"
gosub [listit]
sort r(),1,6,maintotal
print " "
print " >>maintotal<< "
gosub [listit]
wait
print " # "
for r=1 to 3
for c= 1 to col
print using("###.", r(r,c));
next
next
return
next i
wait
[listit]
print " # "
for r=1 to 4
for c= 1 to col
print using("###.", r(r,c));
next
next
return
'THE TEXTFILE MUST HAVE DATA IN THE ORDER OF TH ABOVE PRINT STATEMENT