I lack the programming skillz and this is a school assignment. So far, its been pretty ok. This one is stumping me for some reason.
Here is a basic sample of what I'm trying to do.
CLS
DIM phone$(100), name$(100)
i = 0
DO
i = i + 1
READ name$(i), phone$(i)
LOOP UNTIL name$(i) = "EOD"
size = i - 1
'Bubble Sort Total number of passes = (n-1) * (n-1)
FOR scnt = 1 TO size - 1
FOR j = 1 TO size - 1
IF name$(j) > name$(j + 1) THEN '> ==> < descending order
SWAP name$(j), name$(j + 1)
SWAP phone$(j), phone$(j + 1)
END IF
NEXT j
NEXT scnt
PRINT "Name", "Phone"
FOR i = 1 TO size
PRINT name$(i), phone$(i)
NEXT i
END
DATA Jill, 555-5555, Sam, 111-1111
DATA Sue, 777-7777, Ed, 222-2222
DATA Bill, 333-3333, EOD, ***-****
This is the easy part (generic bubble sorting). Its basically two sets of data. Name and Phone number.
I need to start the program out by asking how I want to search said data (by phone or name) and after it sorts it based on my decision, it should ask if I want to do the same thing again until I say no.
Any ideas? I've speant the last few nights scrounging google, reading my testbook chapters repeatedly and I'm about dead on the matter. haha.
Thank you for any assitance!
Here is a basic sample of what I'm trying to do.
CLS
DIM phone$(100), name$(100)
i = 0
DO
i = i + 1
READ name$(i), phone$(i)
LOOP UNTIL name$(i) = "EOD"
size = i - 1
'Bubble Sort Total number of passes = (n-1) * (n-1)
FOR scnt = 1 TO size - 1
FOR j = 1 TO size - 1
IF name$(j) > name$(j + 1) THEN '> ==> < descending order
SWAP name$(j), name$(j + 1)
SWAP phone$(j), phone$(j + 1)
END IF
NEXT j
NEXT scnt
PRINT "Name", "Phone"
FOR i = 1 TO size
PRINT name$(i), phone$(i)
NEXT i
END
DATA Jill, 555-5555, Sam, 111-1111
DATA Sue, 777-7777, Ed, 222-2222
DATA Bill, 333-3333, EOD, ***-****
This is the easy part (generic bubble sorting). Its basically two sets of data. Name and Phone number.
I need to start the program out by asking how I want to search said data (by phone or name) and after it sorts it based on my decision, it should ask if I want to do the same thing again until I say no.
Any ideas? I've speant the last few nights scrounging google, reading my testbook chapters repeatedly and I'm about dead on the matter. haha.
Thank you for any assitance!