My problem is folloving:
2 of data rows groups with 5 number in each row,for example
data 3,5,8,6,2
data 4,2,7,9,4
data5,1,7,9,3
data 6,3,1,4,2,
to be combined with
data 12,15,33,43,45
data 11,18,20,31,35
data 14,16,45,34,89
data 17,19,23,45,57
so that printing will be 16 rows ,all combined with eachather
3 5 8 6 2 12 15 33 43 45
3 5 8 6 2 11 18 20 31 35
e.t.c.
Can somebody help me?
(excuse for my English)
thanks
Combined DATA rows
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Re: Combined DATA rows
You can put DATA anywhere in the program and READ each value consecutively or READ specific labeled data fields by using line labels with RESTORE. Only problem is that it starts at the beginning of each field so you may have to read some more than once.
I'll let you figure out the rest...
Code: Select all
FOR i = 1 TO 5
READ dat 'can read first data w/o restore
PRINT dat;
NEXT
RESTORE datafield2
FOR i = 1 TO 5
READ dat 'can read second data block with restore
PRINT dat;
NEXT
datafield1:
DATA 3,5,8,6,2
DATA 4,2,7,9,4
DATA 5,1,7,9,3
DATA 6,3,1,4,2,
'to be combined with
datafield2:
DATA 12,15,33,43,45
DATA 11,18,20,31,35
DATA 14,16,45,34,89
DATA 17,19,23,45,57
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Re: Combined DATA rows
Hint: Combining the lines would be easier if you somehow could access the data like an array . . .
For any grievances posted above, I blame whoever is in charge . . .
Re: Combined DATA rows
1. group data --> data1.txt
2. group data --> data2.txt
open data1.txt as #1
open data2.txt as #2
open new.txt as #3
do until eof(1) or eof(2)
line input #1, a$
line input #2, b$
c$=a$+b$
print #3,c$
loop
close
etc
2. group data --> data2.txt
open data1.txt as #1
open data2.txt as #2
open new.txt as #3
do until eof(1) or eof(2)
line input #1, a$
line input #2, b$
c$=a$+b$
print #3,c$
loop
close
etc