Qbasicnews.com
May 25, 2022, 10:26:31 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Back to Qbasicnews.com
|
QB Online Help
|
FAQ
|
Chat
|
All Basic Code
|
QB Knowledge Base
Home
Help
Search
Login
Register
Qbasicnews.com
>
QBasic
>
QB Discussion & Programming Help
>
In need of help with parallel arrays
Pages: [
1
]
« previous
next »
Print
Author
Topic: In need of help with parallel arrays (Read 7823 times)
bridgettelott
New Member
Posts: 2
In need of help with parallel arrays
«
on:
November 06, 2009, 01:48:26 AM »
Hey Everyone!
I'll start by saying that I'm NOT looking for help on a homework assignment. I'm taking a class that basically teaches the logic behind programming. It doesn't teach a specific language, but we use QBASIC to write beginning programs. I understand how to write pseudocode with parallel arrays. However, I don't know how to properly format them for QBASIC. I was just wondering if someone would respond to this message with a couple of parallel arrays and a brief explanation about the individual components.
Have a wonderful day!
~Bridgette~
Logged
Live, Love, Laugh
Clippy
Member
Posts: 84
Re: In need of help with parallel arrays
«
Reply #1 on:
November 06, 2009, 05:20:21 AM »
What is a parallel array? Do you mean a string array for a name and a integer array for the age or something like that?
Let's go with that....
DIM Names(100)
DIM Ages(100)
So now you have two arrays that can hold 100 names and ages.
Now all you have to do is fill the array element values in the program.
1) Get the data from a user entry
2) Get data from the program using DATA field
3) Get data from a file
The array elements should match the data supplied.
So If I enter "Ted" for the name and 50 for my age, then :
PRINT Names(1) ' displays Ted
PRINT Ages(1) ' displays 50
You can create other arrays for different number types.
Logged
Get my QB demonstrator here:
http://dl.dropbox.com/u/8440706/Q-Basics.zip
bridgettelott
New Member
Posts: 2
Re: In need of help with parallel arrays
«
Reply #2 on:
November 06, 2009, 06:20:57 PM »
Hi Clippy!
Thanks for responding to my post! According to my textbook, parallel arrays refer to two corresponding arrays where each element in one array is associated with the element in the same relative position in the other array. Your example definitely fits as a parallel array. I was confused about how an association was made between the two elements in different arrays. Now, I can see its the number in the () that forms the association. I'm learning slowly, but surely ... I greatly appreciate your help!
Have a blessed day!
~Bridgette~
Logged
Live, Love, Laugh
Clippy
Member
Posts: 84
Re: In need of help with parallel arrays
«
Reply #3 on:
November 07, 2009, 07:24:08 PM »
OOPS I forgot to define the Array types:
DIM Names(100) AS STRING
DIM Ages(100) AS INTEGER
Logged
Get my QB demonstrator here:
http://dl.dropbox.com/u/8440706/Q-Basics.zip
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Forum has moved
-----------------------------
=> Forum has moved
-----------------------------
QbasicNews.Com
-----------------------------
=> QB/FB News
=> Site/Forum Issues
=> Challenges
-----------------------------
QBasic
-----------------------------
=> QB Discussion & Programming Help
=> QB Projects
-----------------------------
Qbasic "like" compilers/interpreters
-----------------------------
=> General QB "like"
=> QB64
=> FB Discussion & Programming Help
===> FB Projects
===> FB Documentation
-----------------------------
General
-----------------------------
=> General/Misc
===> Art & Music
===> General Programming
Loading...