Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please Help Me
#11
Code:
FOR i% = 1 to 100
FOR j% = 1 TO i% - 1
IF array1(j%) > array1(i%) THEN
SWAP array1(j%), array1(i%)
SWAP names(j%), names%(i%)
SWAP bla(j%), bla(i%)
END IF
NEXT j%, i%

array1
names
bla

are your variables here. array1 is the array that you are actually sorting on, and the other arrays tag along.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#12
So what do i have to do to the last code u posted for it to work....Sorry man im just confused....
Reply
#13
1) replace array1 with the variable array you are sorting on.
2) replace 100 with the length of your array.
3) replace/add names()/bla() with the other arrays.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#14
Ok i think i got it....Thanks for the help....
Reply
#15
Ok i dont have it like i thought....I get a wrong number of dimensions or something like that....Heres the code:

SUB Sort

FOR i% = 1 TO 11
FOR j% = 1 TO i# - 1
IF Grid$(j%) > Grid(i%) THEN
SWAP Grid$(j%), Grid$(i%)
SWAP names(j%), names%(i%)
SWAP address(j%), address(i%)
SWAP id(j%), id(i%)
SWAP gender(j%), gender(i%)
SWAP hourlysalary(j%), hourlysalary(i%)
END IF
NEXT j%, i%
Reply
#16
When i change stuff around i get array not defined and stuff....Please help....
Reply
#17
1) You have some typos: Variable types don't match up.
2) Also, don't forget that you need to DIM SHARED each variable.
3) Grid$ isn't one of your 5 attributes.
4) Remember, names and address must be string ($) arrays.

Code:
FOR i% = 1 TO 11
FOR j% = 1 TO i% - 1
IF names$(j%) > names$(i%) THEN
SWAP names$(j%), names$(i%)
SWAP address$(j%), address$(i%)
SWAP id(j%), id(i%)
SWAP gender(j%), gender(i%)
SWAP hourlysalary(j%), hourlysalary(i%)
END IF
NEXT j%, i%
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#18
Ok i get array not defined....How do i dim share each variable....Thanx
Reply
#19
Open your eyes! USE QB HELP!

Code:
grid.length% = 5
DIM SHARED grid.name$(1 to grid.length%), grid.address$(1 to grid.length%), grid.id%(1 to grid.length%), grid.gender%(1 to grid.length%), grid.hourlysalary&(1 to grid.length%)

DIM SHARED gender.type$(1 TO 2)

gender.type$(1) = "Male"
gender.type$(2) = "Female"

FOR i% = 1 TO grid.length%
PRINT grid.name$(i%)
PRINT grid.address$(i%)
PRINT grid.id%(i%)
PRINT gender.type$(grid.gender%(i%))
PRINT grid.hourlysalary&(i%)
NEXT i%
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#20
Sorry but where does this code go
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)