![]() |
![]() |
#1 |
Sep 2004
416 Posts |
![]()
How do I store all the numbers from 0 to 1000,in an array?thanks a lot for your time.
Last fiddled with by rn0dal on 2004-09-14 at 06:12 |
![]() |
![]() |
![]() |
#2 | |
Sep 2002
10616 Posts |
![]() Quote:
for x=0 to 1000 a(x)=x next use the help starter to get help ubh.bat Joss Last fiddled with by jocelynl on 2004-09-14 at 08:35 |
|
![]() |
![]() |
![]() |
#3 |
Sep 2004
22 Posts |
![]()
Thanks a lot for your help,now one more question,lets say I want that array to be, (the number the user enters) - 2.How would I do that?
could it be like this? 10 input "Last Number";x 20 p=0 30 Dim m(x-2) 40 For I = 2 to x 50 m(p) = I 60 p = p + 1 70 next I the reason why i aked it becuase I did not find an example about it. Last fiddled with by rn0dal on 2004-09-14 at 14:58 |
![]() |
![]() |
![]() |
#4 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
3×7×19×23 Posts |
![]()
You should be able to eliminate p.
Assuming you want x-2 elements and each element m(z) to be equal to z+2, try this: Code:
10 input "Last Number";x 30 Dim m(x-2) 40 For i = 2 to x 50 m(i-2) = i 70 next i m(1)=3 ...... m(x)=x+2 My arrays are a bit rusty, but each extra step you get rid of (and counters that are doing the same steping, like p & i), speeds things along. |
![]() |
![]() |
![]() |
#5 |
Sep 2004
22 Posts |
![]()
it gives me this error:
Variable area full. in 20 Thats why I asked the question.thanks a lot for your time, and for the tip (i-2). -r |
![]() |
![]() |
![]() |
#6 |
Sep 2004
416 Posts |
![]()
Never mind last post, how can increase the range?so i can enter a big number,you know so I can enter the bigest number allowed by UBASIC, I dont know maybe there is a way of declaring the array so it can get bigger than 300, I want to be able to use the biggest posible number.thanks a lot for your time.
|
![]() |
![]() |
![]() |
#7 |
Sep 2002
2·131 Posts |
![]()
Ubasic use a stack of 65536
The dim can't be larger than 32768 * 2 words for small integers dim x%() when not using the % Ubasic use 542 words to store each numbers you can reduce the number of words used by ubasic in help look under (word) Joss |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to init an array in Posix bc? | ewmayer | Linux | 29 | 2018-03-08 21:42 |
Array vs Hash Table vs Map for QS | Sam Kennedy | Programming | 1 | 2012-12-25 23:25 |
ubasic: overflow? | Andi47 | Programming | 7 | 2009-02-27 00:20 |
ubasic question - strings | Andi47 | Programming | 5 | 2008-12-28 05:52 |
array of bits | Citrix | Programming | 2 | 2005-08-21 20:06 |