| | |
GW Basic variables
![]() |
•
•
Join Date: Jul 2008
Posts: 7
Reputation:
Solved Threads: 0
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
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
Not sure what you mean by . 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.
•
•
•
•
convert string "A" into numerical variables A1, A2,
FWIW. Been a few years since i did BASIC.
Ken Thompson, Mainframe Dinosaur
•
•
Join Date: Jul 2008
Posts: 7
Reputation:
Solved Threads: 0
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.
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.
![]() |
Similar Threads
- Please help me with this very basic variables question... (PHP)
- Basic Variables Question (Visual Basic 4 / 5 / 6)
- Hamurgers... Oo (Java)
- Is there a simpler way to code this? (C++)
- Visual Basic variables in DOS (Visual Basic 4 / 5 / 6)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Simple DOS command info required
- Next Thread: Good Language for Programming AI
| Thread Tools | Search this Thread |





