Page 1 of 1

arrays, sequential files

Posted: Tue Nov 11, 2003 7:03 pm
by Guest
OK, call me a dummy. :o I am writing a program that involves creating, & opening  a sequential file, then writing it to an array. 1st I am kinda confused on the whole array concept. "anybody know "ARRAYS FOR DUMMIES"? 2nd, it says file already open but I wrote "close fole #1" in my code. help. I am failing AND I am on academic probation. I cant lose my financial aid. ANYBODY IN AZ THAT CAN TUTOR ME ?  :'(

Re: arrays, sequential files

Posted: Wed Nov 12, 2003 12:29 am
by frankiebaby
well to close a file in qbasic, u must use close #1, not close file #1. now, about arrays:

One dimensional arrays are kind of like a divided drawer.
You only want one kind of information in a particular drawer, and inside that drawer you want the information organized or ordered in some way as so you can easily find the information later. SO, if our drawer was named SOCKS we would have several boxes in a column in our drawer and each would have one pair of socks in them, Each with a label, maybe by size. This keeps all data (or socks) in one place.

SOCKS
---------------------
|   1   |  2   |  3
---------------------

Multidimensional arrays are like whole filing cabinets, with more than one drawer:

---------------------------------
|socks | shoes  | pants   |
|--------|----------|----------|
|this    | that     | other thing|
-------------------------------------

so, if you had a bunch of students test grades:
Say there are 40 students:

DIM GRADES (1 to 40) as INTEGER
Now, you can store/find each students grade using only one variable to reference them

to get student 1's grade:
PRINT GRADES(1)

to get student 5's grade:
PRINT GRADES(5)

to get student x's grade:
PRINT GRADES(x)

to change them:
GRADES(5) = 90  'this makes student 5's grade a 90

I hope this helps some, let me know if you need any more help, or email me