Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hey Agamemnus!!!!
#21
It would be nice if.... someone... made a TYPE rewriter . . .
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
#22
Or, you could use QB71 (PDS?). It's almost the same, but with improved functionality. I think... Haven't used it much.

Could somebody tell me why nobody's using QB71?

HPLilSnowHP: Where in the code, more exactly, are you having trouble?
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Reply
#23
Quote:It would be nice if.... someone... made a TYPE rewriter . . .
It would be even nicer if someone wrote an Agamemnus rewriter Tongue Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#24
Hey Zap....I having trouble with this part because it says something about cant contain a period when i put info.Nme$....Thanx

Code:
TYPE ClassRecord
Nme AS STRING * 15
Address AS STRING * 38
Id AS INTEGER
gender AS STRING * 6
Payrate AS SINGLE
END TYPE

DIM Info(1 TO 11) AS ClassRecord

CLS
PRINT "Choose how you want to sort the items!"
PRINT "--------------------------------------"
PRINT
PRINT "By name          Press 1"
PRINT "By address       Press 2"
PRINT "By id            Press 3"
PRINT "By gender        Press 4"
PRINT "By payrate       Press 5"
INPUT "Which do you want to sort by"; sort.item%
'PRINT
'PRINT "Type screen to print on screen, type printer to print from printer."
'PRINT "-------------------------------------------------------------------"
'INPUT "Do you want to print on screen or print on printer"; print$

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

CALL Information
CALL Sort
'CALL Printing

CLS

FOR i% = 1 TO 11
PRINT "Name: "; Nme$(i%);
SLEEP 1
PRINT " Address: "; Address$(i%)
PRINT "ID: "; Id(i%)
PRINT "Gender: "; gender.type$(gender%(i%))
PRINT "Hourly Salary: $"; Payrate(i%)
PRINT
NEXT i%

SUB Information

Nme$(1) =
Nme$(2) =
Nme$(3) =
Nme$(4) =
Nme$(5) =
Nme$(6) =
Nme$(7) =
Nme$(8) =
Nme$(9) =
Nme$(10) =
Nme$(11) =

Address$(1) =
Address$(2) =
Address$(3) =
Address$(4) =
Address$(5) =
Address$(6) =
Address$(7) =
Address$(8) =
Address$(9) =
Address$(10) =
Address$(11) =

Id(1) =
Id(2) =
Id(3) =
Id(4) =
Id(5) =
Id(6) =
Id(7) =
Id(8) =
Id(9) =
Id(10) =
Id(11) =

gender%(1) = 1
gender%(2) = 1
gender%(3) = 1
gender%(4) = 1
gender%(5) = 1
gender%(6) = 1
gender%(7) = 1
gender%(8) = 1
gender%(9) = 1
gender%(10) = 2
gender%(11) = 2

Payrate(1) = 6.3
Payrate(2) = 8.13
Payrate(3) = 8
Payrate(4) = 9.5
Payrate(5) = 7.35
Payrate(6) = 8.2
Payrate(7) = 6.95
Payrate(8) = 7.46
Payrate(9) = 6.25
Payrate(10) = 8.51
Payrate(11) = 6
Reply
#25
Oh, it's not classrecord.

It should be Info(i%).nme$
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
#26
I tried that....It still says identifier cannot contain a period....
Reply
#27
Post your program again.. Could be a typo? It won't work if it's something like this, for instance:

Code:
TYPE classrecord
nme AS STRING * 10
END TYPE
DIM info(1) AS classrecord
info2(1).nme$ = "1"

...but it will work with this:
Code:
TYPE classrecord
nme AS STRING * 10
END TYPE
DIM info(1) AS classrecord
info(1).nme$ = "1"

PS: To complete your newbie-ish training, you must resist the urge to use deep breaths between sentences ("....")
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
#28
Alright heres the code

Code:
DECLARE SUB Information ()
DECLARE SUB Sort ()
'DECLARE SUB Printing ()

DIM SHARED sort.item%
DIM SHARED entry.amount%
DIM SHARED gender.type$(1 TO 2)
DIM SHARED Nme$(1 TO 11)
DIM SHARED Address$(1 TO 11)
DIM SHARED Id(1 TO 11) AS LONG
DIM SHARED gender%(1 TO 11)
DIM SHARED Payrate(1 TO 11)

TYPE ClassRecord
Nme AS STRING * 15
Address AS STRING * 38
Id AS INTEGER
gender AS STRING * 6
Payrate AS SINGLE
END TYPE

DIM Info(1 TO 11) AS ClassRecord

CLS
PRINT "Choose how you want to sort the items!"
PRINT "--------------------------------------"
PRINT
PRINT "By name          Press 1"
PRINT "By address       Press 2"
PRINT "By id            Press 3"
PRINT "By gender        Press 4"
PRINT "By payrate       Press 5"
INPUT "Which do you want to sort by"; sort.item%
'PRINT
'PRINT "Type screen to print on screen, type printer to print from printer."
'PRINT "-------------------------------------------------------------------"
'INPUT "Do you want to print on screen or print on printer"; print$

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

CALL Information
CALL Sort
'CALL Printing

CLS

FOR i% = 1 TO 11
PRINT "Name: "; Nme$(i%);
SLEEP 1
PRINT " Address: "; Address$(i%)
PRINT "ID: "; Id(i%)
PRINT "Gender: "; gender.type$(gender%(i%))
PRINT "Hourly Salary: $"; Payrate(i%)
PRINT
NEXT i%

SUB Information

Nme$(1) =
Nme$(2) =
Nme$(3) =
Nme$(4) =
Nme$(5) =
Nme$(6) =
Nme$(7) =
Nme$(8) =
Nme$(9) =
Nme$(10) =
Nme$(11) =

Address$(1) =
Address$(2) =
Address$(3) =
Address$(4) =
Address$(5) =
Address$(6) =
Address$(7) =
Address$(8) =
Address$(9) =
Address$(10) =
Address$(11) =

Id(1) =
Id(2) =
Id(3) =
Id(4) =
Id(5) =
Id(6) =
Id(7) =
Id(8) =
Id(9) =
Id(10) =
Id(11) =

gender%(1) = 1
gender%(2) = 1
gender%(3) = 1
gender%(4) = 1
gender%(5) = 1
gender%(6) = 1
gender%(7) = 1
gender%(8) = 1
gender%(9) = 1
gender%(10) = 2
gender%(11) = 2

Payrate(1) = 6.3
Payrate(2) = 8.13
Payrate(3) = 8
Payrate(4) = 9.5
Payrate(5) = 7.35
Payrate(6) = 8.2
Payrate(7) = 6.95
Payrate(8) = 7.46
Payrate(9) = 6.25
Payrate(10) = 8.51
Payrate(11) = 6

END SUB

SUB Printing

'IF print$ = "Screen" OR print$ = "screen" THEN
    'FOR i% = 1 TO 11
    'PRINT "Name: "; name$(i%);
    'SLEEP 1
    'PRINT " Address: "; address$(i%)
    'PRINT "ID: "; id(i%)
    'PRINT "Gender: "; gender.type$(gender%(i%))
    'PRINT "Hourly Salary: $"; hourlysalary(i%)
    'PRINT
    'NEXT i%
'ELSE
    'FOR i% = 1 TO 11
    'LPRINT "Name: "; name$(i%);
    'SLEEP 1
    'LPRINT " Address: "; address$(i%)
    'LPRINT "ID: "; id(i%)
    'LPRINT "Gender: "; gender.type$(gender%(i%))
    'LPRINT "Hourly Salary: $"; hourlysalary(i%)
    'LPRINT
    'LPRINT
    'NEXT i%
'END IF

END SUB

SUB Sort

SELECT CASE sort.item%
CASE 1
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Nme$(j%) > Nme$(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 2
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Address$(j%) > Address$(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 3
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Id(j%) > Id(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 4
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF gender%(j%) > gender%(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 5
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Payrate(j%) > Payrate(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%
END SELECT
END SUB
Reply
#29
I don't understand something.

How can you claim to have tried what I showed you and not have it in the code?

Second,

DIM SHARED Nme$(1 TO 11)
DIM SHARED Address$(1 TO 11)
DIM SHARED Id(1 TO 11) AS LONG
DIM SHARED gender%(1 TO 11)
DIM SHARED Payrate(1 TO 11)

have to be removed.

And what about the empty variables?

Post code where you actually get the error message that you earlier described.
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
#30
Heres the code where i get the error:
Where info(i%).nme$ is and i have to do that all the way till i get to payrate but it wont work

Code:
DECLARE SUB Information ()
DECLARE SUB Sort ()
'DECLARE SUB Printing ()

DIM SHARED sort.item%
DIM SHARED entry.amount%
DIM SHARED gender.type$(1 TO 2)
DIM SHARED Nme$(1 TO 11)
DIM SHARED Address$(1 TO 11)
DIM SHARED Id(1 TO 11) AS LONG
DIM SHARED gender%(1 TO 11)
DIM SHARED Payrate(1 TO 11)

TYPE ClassRecord
Nme AS STRING * 15
Address AS STRING * 38
Id AS INTEGER
gender AS STRING * 6
Payrate AS SINGLE
END TYPE

DIM Info(1 TO 11) AS ClassRecord

CLS
PRINT "Choose how you want to sort the items!"
PRINT "--------------------------------------"
PRINT
PRINT "By name          Press 1"
PRINT "By address       Press 2"
PRINT "By id            Press 3"
PRINT "By gender        Press 4"
PRINT "By payrate       Press 5"
INPUT "Which do you want to sort by"; sort.item%
'PRINT
'PRINT "Type screen to print on screen, type printer to print from printer."
'PRINT "-------------------------------------------------------------------"
'INPUT "Do you want to print on screen or print on printer"; print$

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

CALL Information
CALL Sort
'CALL Printing

CLS

FOR i% = 1 TO 11
PRINT "Name: "; Nme$(i%);
SLEEP 1
PRINT " Address: "; Address$(i%)
PRINT "ID: "; Id(i%)
PRINT "Gender: "; gender.type$(gender%(i%))
PRINT "Hourly Salary: $"; Payrate(i%)
PRINT
NEXT i%

SUB Information

Info(i%).Nme$ =
Info(i%).Nme$ =
Nme$(3) =
Nme$(4) =
Nme$(5) =
Nme$(6) =
Nme$(7) =
Nme$(8) =
Nme$(9) =
Nme$(10) =
Nme$(11) =

Address$(1) =
Address$(2) =
Address$(3) =
Address$(4) =
Address$(5) =
Address$(6) =
Address$(7) =
Address$(8) =
Address$(9) =
Address$(10) =
Address$(11) =

Id(1) =
Id(2) =
Id(3) =
Id(4) =
Id(5) =
Id(6) =
Id(7) =
Id(8) =
Id(9) =
Id(10) =
Id(11) =

gender%(1) = 1
gender%(2) = 1
gender%(3) = 1
gender%(4) = 1
gender%(5) = 1
gender%(6) = 1
gender%(7) = 1
gender%(8) = 1
gender%(9) = 1
gender%(10) = 2
gender%(11) = 2

Payrate(1) = 6.3
Payrate(2) = 8.13
Payrate(3) = 8
Payrate(4) = 9.5
Payrate(5) = 7.35
Payrate(6) = 8.2
Payrate(7) = 6.95
Payrate(8) = 7.46
Payrate(9) = 6.25
Payrate(10) = 8.51
Payrate(11) = 6

END SUB

SUB Printing

'IF print$ = "Screen" OR print$ = "screen" THEN
    'FOR i% = 1 TO 11
    'PRINT "Name: "; name$(i%);
    'SLEEP 1
    'PRINT " Address: "; address$(i%)
    'PRINT "ID: "; id(i%)
    'PRINT "Gender: "; gender.type$(gender%(i%))
    'PRINT "Hourly Salary: $"; hourlysalary(i%)
    'PRINT
    'NEXT i%
'ELSE
    'FOR i% = 1 TO 11
    'LPRINT "Name: "; name$(i%);
    'SLEEP 1
    'LPRINT " Address: "; address$(i%)
    'LPRINT "ID: "; id(i%)
    'LPRINT "Gender: "; gender.type$(gender%(i%))
    'LPRINT "Hourly Salary: $"; hourlysalary(i%)
    'LPRINT
    'LPRINT
    'NEXT i%
'END IF

END SUB

SUB Sort

SELECT CASE sort.item%
CASE 1
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Nme$(j%) > Nme$(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 2
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Address$(j%) > Address$(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 3
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Id(j%) > Id(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 4
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF gender%(j%) > gender%(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%

CASE 5
    FOR i% = 1 TO 11
    FOR j% = 1 TO i%
    IF Payrate(j%) > Payrate(i%) THEN
    SWAP Nme$(j%), Nme$(i%)
    SWAP Address$(j%), Address$(i%)
    SWAP Id(j%), Id(i%)
    SWAP gender%(j%), gender%(i%)
    SWAP Payrate(j%), Payrate(i%)
    END IF
    NEXT j%, i%
END SELECT
END SUB
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)