Data update

This commit is contained in:
Ingy döt Net 2024-11-11 10:11:44 -08:00
parent 157b70a810
commit 8e4e15fa56
78 changed files with 2016 additions and 222 deletions

View file

@ -57,8 +57,7 @@ module Sort_an_array_of_composite_structures{
return
}
Sort_an_array_of_composite_structures
Pint
module Checkit2 {
Inventory Alfa="Joe":=5531, "Adam":=2341, "Bernie":=122
Append Alfa, "Walter":=1234, "David":=19
@ -69,6 +68,7 @@ module Checkit2 {
}
}
Checkit2
Print
module Checkit3 {
class any {
x
@ -80,11 +80,37 @@ module Checkit3 {
Sort Alfa
k=Each(Alfa)
While k {
\\ k^ is the index number by k cursor
\\ Alfa("joe") return object
\\ Alfa(0!) return first element object
\\ Alfa(k^!) return (k^) objext
' k^ is the index number by k cursor
' Alfa("joe") return object
' Alfa(0!) return first element object
' Alfa(k^!) return (k^) objext
Print eval$(Alfa, k^), Alfa(k^!).x
}
}
Checkit3
Module Sort2Darray {
const ascending=0, descending=1
const Names=0, Rate=1
flush
Data "Bernie", 1
Data "Adam", 2341
Data "David", 19
Data "Bernie", 5
Data "Joe", 5531
Data "Walter", 1234
Data "Bernie", 122
k=stack.size/2
dim a(k,2)
Pen 15 {Print "Fill Array"}
for i=0 to k-1: read a(i,0), a(i,1): next
Pen 15 {Print "Unsorted"}
for i=0 to k-1: ? a(i,0), a(i,1): next
' there is a special sort for 2D arrays
profiler
sort a(),0,k-1,Names, ascending, Rate, descending
print timecount
Pen 15 {Print "Sorted"}
for i=0 to k-1: ? a(i,0), a(i,1): next
}
Sort2Darray