home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1984 January to June
/
Ahoy_Magazine_84-Jan-Jun_1984_Double_L.d64
/
array3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
353b
|
17 lines
0 rem--ahoy!--may issue--arrays--prog page 69
5 n=4
10 for i=1 to n:read n$(i),a(i):next i
20 data amy,25,abe,12,arthur,30,anne,5
30 rem - sort by name -
40 for i=1 to n
50 for j=i to n
60 if n$(i)>n$(j) then gosub 1000
70 next j
80 next i
90 for i=1 to n:print n$(i),a(i):next
100 end
990 rem - swap names and ages -
1000 t$=n$(i):n$(i)=n$(j):n$(j)=t$
1010 t=a(i):a(i)=a(j):a(j)=t
1020 return