Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
stuck need help
#1
ok here is the question.. im working on trying to figure out a sort routine were the code will sort my txt file of names by last name.

I try the the line
Print Mid$(presname$(i)) but get errors.. can you tell me why it does that. I know it is somewhere with that line but not sure why..

Quote:CLS
PRINT TAB(60); "*"
PRINT TAB(60); "*"

DIM presname$(0 TO 42)

OPEN "f:/pres.txt" FOR INPUT AS #1
DIM index

INPUT #1, presname$(index)
DO WHILE NOT EOF(1)
index = index + 1
INPUT #1, presname$(index)
LOOP



FOR i = 0 TO 42
PRINT presname$(i)
NEXT i



OPEN "f:/output.txt" FOR OUTPUT AS #2

FOR i = 0 TO 42
PRINT #2, presname$(i)
NEXT i
Reply
#2
MID$ takes three arguments, not one...

MID$(string_to_get_part_of$, starting_place%, length_to_take%) (I think, the last two might be the other way around).

You'll have to do some basic math to work out the last two parameters.
Reply
#3
cool. that could be why it wasnt working...lol ill try it. thanks.
Reply
#4
hmm obviously i cant get it. now could i use a bubble sort and somehow get it to read the last name first, then the first and middle.... i kind of have a idea how it works but
Reply
#5
anyone up for all nighter im stuck..lol i suck at this stuff.. lol
Reply
#6
Well, we'll need more clues than that to help you out. Posting that "i've got a problem with a bubble sort" and then not posting the code is pretty pointless Wink

Post your code, and where you're stuck, and then anyone here can help you Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)