GW Basic variables

Reply

Join Date: Jul 2008
Posts: 7
Reputation: kanga85 is an unknown quantity at this point 
Solved Threads: 0
kanga85 kanga85 is offline Offline
Newbie Poster

GW Basic variables

 
-1
  #1
Sep 4th, 2009
I have a program in GW Basic to collect data, and it needs to be re-written as the data is increasing and would be best handled within a loop.

I read in range of string data; "A", "B", .... within the loop. I then need to input, from the keyboard, numerical data, say A1, A2, A3, A4 against each of these String variables.

Q. How do I convert string "A" into numerical variables A1, A2, ...? I cannot find anyway in GW Basic that allows this.

Thanks
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 4
Reputation: kthompsn is an unknown quantity at this point 
Solved Threads: 0
kthompsn's Avatar
kthompsn kthompsn is offline Offline
Newbie Poster

Re: GW Basic variables

 
0
  #2
Sep 7th, 2009
Not sure what you mean by
convert string "A" into numerical variables A1, A2,
. If you're trying to associate the numeric input with the string variable, could be done with a table? If the string data is single character, then IIRC the VAL() function would return the ASCII value of the string. So the table(1,1) would be VAL(A$), table(1,2) would be A1...., table(2,1) would be VAL(B$), table(2,2) would be B1..... to the end of the loop.

FWIW. Been a few years since i did BASIC.
Ken Thompson, Mainframe Dinosaur
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 7
Reputation: kanga85 is an unknown quantity at this point 
Solved Threads: 0
kanga85 kanga85 is offline Offline
Newbie Poster

Re: GW Basic variables

 
0
  #3
Sep 7th, 2009
Thanks Ken.
I may have gotten around the problem myself by simply collecting the data in pre-defined arrays: A(), B() ..., which avoids the problem of trying to generate, on the run, new variable names for numbers from string characters.
But I will play with your ideas to see where I can go.
In the 'old' days (early 1980's), this problem was easily solved by poking the required characters into basic memory, but I feel less confident about that on a modern computer running XP.
Thanks.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC