ARRAYS

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
dave
Newbie
Posts: 3
Joined: Mon Oct 02, 2006 8:44 pm

ARRAYS

Post by dave »

i have this code:

INPUT "Total contestants";c

FOR T = 1 TO C
INPUT "NAME";NAME$
INPUT "TICKETS";T
NEXT T

NOW WHAT I NEED TO KNOW WHAT TO DO IS HOW ASSIGN THE NAME AND TICKETS TO DIFFERENT VARIABLES FOR WHEN IT GOES AROUND THE LOOP SO WHEN T = 1 IT WILL ASSIGN NAME$ AND T TO NAME1$ AND T1
WHEN T = 2 IT WILL ASSIGN THE NEW NAME TO NAME2$ AND T2 AND I NEED IT TO BE ABLE TO ASSIGN DIFFERENT NAMES TO THE DIFFERENT VARIABLES TO ANY AMMOUNT OF TIMES
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Pay attention in class, ask your professor for help, or go use one of the 600+ tutorials on this site. I recommend a set written by Vic.
Image
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

At first, DONT YELL :lol:

Use arrays. As nathan sayd, give attention.

For i = 1 TO 10
Array("what we should have here?") = i
Next i
User avatar
Quibbler
Coder
Posts: 16
Joined: Tue Jan 24, 2006 7:29 am
Location: Trinidad and Tobago

Post by Quibbler »

You can't use T twice (you have FOR T=... and INPUT T...)
for your other problem arrays are the answer

FOR I=1 to N
input "name";name$(i)
input "tickets";t(i)
next i

Don't forget is you're going over 10 you will need to dimension these arrays.
Post Reply