• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 In need of help with parallel arrays bridgettelott Junior Member Posts: 2 Threads: 1 Joined: Nov 2009 11-06-2009, 09:48 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~ Live, Love, Laugh Clippy Member Posts: 82 Threads: 8 Joined: Jul 2008 11-06-2009, 01:20 PM 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. Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip bridgettelott Junior Member Posts: 2 Threads: 1 Joined: Nov 2009 11-07-2009, 02:20 AM 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~ Live, Love, Laugh Clippy Member Posts: 82 Threads: 8 Joined: Jul 2008 11-08-2009, 03:24 AM OOPS I forgot to define the Array types: DIM Names(100) AS STRING DIM Ages(100) AS INTEGER Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip « Next Oldest | Next Newest »

Forum Jump:

Users browsing this thread: 1 Guest(s)