Liberty BASIC Community Forum
« use a file inplace of data »

Welcome Guest. Please Login or Register.
Feb 18th, 2018, 3:39pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: use a file inplace of data  (Read 79 times)
debluzz
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 136
xx use a file inplace of data
« Thread started on: Feb 1st, 2018, 08:58am »




This program runs using the data listed within it.
I have a separate .dat file , but the program won't get the data from it'
Can some one show me how to get the data (from the file) instead of the listed data?



'dim an 8x8 array to hold the row and column data
col=4
row=8
dim r$(row,col)
for r=1 to row
for c=1 to col
read v$
r$(r,c)=v$
next
next

'print the array as loaded
print "The array as loaded"
PRINT "class %"
'gosub

    cls
    'To sort in decending order go from row 8 to 1 assending go 1 to 8
    'NEED TO MAKE SO THAT DATA ARRAY IS LOADED AUTOMATICLY
    print "2-SETS OF DATA ARRAY MUST BE CHANGED BEFORE THIS OPTION CAN BE USED "
    print " THE FIRST TWO OPTIONS ARE %, SECOND TWO ARE CLS"
    PRINT " "
    print "enter: 1=LOW % order 2=HIGH % order**** 3=LOW CLS order**** 4=HIGH CLS order****"

    input a
    if a=1 then
    cls
    print " study HIGH % order and LOW CLSs order"
    print "LOW % order"
    print "bx es cls tot"
    sort r$(),1,8,3'low cls order
    end if
    if a=2 then
    cls
    print " study HIGH % order and LOW CLS order"
    print "HIGH % order****"
    print "bx es cls tot"
    sort r$(),8,1,3'high cls order
    end if
    if a=3 then
    cls
    print " study HIGH % order and LOW CLS order"
    print "LOW CLS order****"
    print "bx es cls tot"
    sort r$(),1,8,2'low % order
    end if
    if a=4 then
    cls
    print " study HIGH % order and LOW CLS order"
    print "HIGH CLS order****"
    print "bx es cls tot"
    sort r$(),8,1,2'high % order
    end if


    print
    'print "class %"
    'gosub


      'wait
      open "ROD.dat" for input as #inFile
      '

        for r=1 to row
        print r$(r,1);" ";r$(r,2);" ";r$(r,3);" ";r$(r,4)
        next
        'close #infile
        '
        'for r=1 to row
        'print r$(r,1);" ";r$(r,2);" ";r$(r,3);" ";r$(r,4);" ";r$(r,5);" ";r$(r,6);" ";r$(r,7);" ";r$(r,8)
        'next


        'return
        wait
        data 1, 28,75,29
        data 2, 21,49,25
        data 3, 31,75,35
        data 4, 29,75,29
        data 5, 31,62,20
        data 6, 30,99,30
        data 7, 24,99,25
        data 8, 28,23,31
        for i=1 to 1

        'dim an 8x8 array to hold the row and column data
        col=4
        row=8
        dim r$(row,col)
        for r=1 to row
        for c=1 to col
        read v$
        r$(r,c)=v$
        next
        next

        'print the array as loaded
        print "The array as loaded"
        PRINT "CLASS %"

        gosub [list1]

        'To sort in decending order go from row 8 to 1 assending go 1 to 8
        sort r$(),1,8,2'low % order
        'sort r$(),8,1,2'high % order
        'sort r$(),1,8,3'low cls order
        'sort r$(),8,1,3'high cls order

        print
        print "CLASS %"
        gosub [list1]

        wait
        open "finish3.txt" for input as #inFile
        [list1]
        for r=1 to row
        print r$(r,1);" ";r$(r,2);" ";r$(r,3);" ";r$(r,4);" ";r$(r,5);" ";r$(r,6);" ";r$(r,7);" ";r$(r,8)
        next
        return

        wait
        data 1, 28,75,29
        data 2, 21,49,25
        data 3, 31,75,35
        data 4, 29,75,29
        data 5, 31,62,20
        data 6, 30,99,30
        data 7, 24,99,25
        data 8, 28,23,31
        next i


User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls